flake: get rid of flake-parts!

This commit is contained in:
Charlie Root 2024-11-01 14:51:13 +01:00
commit 2d5ee6c621
Signed by: faukah
SSH key fingerprint: SHA256:jpYIt4Vkz1NBTQcks/N9OPTfTFxE6KF2W/rV7hrfrIw
11 changed files with 58 additions and 127 deletions

39
flake.lock generated
View file

@ -119,24 +119,6 @@
} }
}, },
"flake-parts": { "flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1727826117,
"narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_2": {
"inputs": { "inputs": {
"nixpkgs-lib": [ "nixpkgs-lib": [
"schizofox", "schizofox",
@ -157,9 +139,9 @@
"type": "github" "type": "github"
} }
}, },
"flake-parts_3": { "flake-parts_2": {
"inputs": { "inputs": {
"nixpkgs-lib": "nixpkgs-lib_2" "nixpkgs-lib": "nixpkgs-lib"
}, },
"locked": { "locked": {
"lastModified": 1698882062, "lastModified": 1698882062,
@ -655,18 +637,6 @@
} }
}, },
"nixpkgs-lib": { "nixpkgs-lib": {
"locked": {
"lastModified": 1727825735,
"narHash": "sha256-0xHYkMkeLVQAMa7gvkddbPqpxph+hDzdu1XdGPJR+Os=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz"
}
},
"nixpkgs-lib_2": {
"locked": { "locked": {
"dir": "lib", "dir": "lib",
"lastModified": 1698611440, "lastModified": 1698611440,
@ -794,7 +764,6 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-parts": "flake-parts",
"helix": "helix", "helix": "helix",
"home-manager": "home-manager", "home-manager": "home-manager",
"hyprland": "hyprland", "hyprland": "hyprland",
@ -834,7 +803,7 @@
"schizofox": { "schizofox": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_2",
"flake-parts": "flake-parts_2", "flake-parts": "flake-parts",
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"nixpak": "nixpak", "nixpak": "nixpak",
"nixpkgs": [ "nixpkgs": [
@ -860,7 +829,7 @@
"searx-randomizer": { "searx-randomizer": {
"inputs": { "inputs": {
"crane": "crane_2", "crane": "crane_2",
"flake-parts": "flake-parts_3", "flake-parts": "flake-parts_2",
"nixpkgs": [ "nixpkgs": [
"schizofox", "schizofox",
"nixpkgs" "nixpkgs"

View file

@ -2,29 +2,19 @@
description = "My NixOS config flake"; description = "My NixOS config flake";
outputs = inputs: let outputs = inputs: let
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux; pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
in in {
inputs.flake-parts.lib.mkFlake {inherit inputs;} { nixosConfigurations = import ./hosts inputs;
systems = ["x86_64-linux"]; formatter.x86_64-linux = pkgs.alejandra;
imports = [ devShells.x86_64-linux.default = pkgs.callPackage ./shell.nix {};
./hosts nixosModules = {
./parts shell = import ./modules/shell;
];
flake = {
formatter.x86_64-linux = pkgs.alejandra;
nixosModules = {
shell = import ./modules/shell;
};
};
}; };
};
inputs = { inputs = {
# what am I doing to this config help
flake-parts.url = "github:hercules-ci/flake-parts";
# Unstable nixpkgs baby! # Unstable nixpkgs baby!
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
# Lix, a faster nix fork. # Lix, a faster nix fork.
lix-module = { lix-module = {
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.0.tar.gz"; url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.0.tar.gz";

View file

@ -1,12 +1,6 @@
{ inputs: let
withSystem,
inputs,
...
}: let
inherit (inputs) self; inherit (inputs) self;
inherit (self) lib; inherit (inputs.nixpkgs) lib;
# inherit (lib.extendedLib.builders) mkSystem;
# inherit (lib.extendedLib.modules) mkModuleTree';
inherit (lib.lists) concatLists flatten singleton; inherit (lib.lists) concatLists flatten singleton;
inherit (lib) mkDefault nixosSystem recursiveUpdate; inherit (lib) mkDefault nixosSystem recursiveUpdate;
inherit (builtins) filter map toString; inherit (builtins) filter map toString;
@ -16,59 +10,48 @@
# to be quite a sane way of managing all modules in my flake. # to be quite a sane way of managing all modules in my flake.
mkSystem = { mkSystem = {
withSystem,
system, system,
hostname, hostname,
... ...
} @ args: } @ args:
withSystem system ( nixosSystem {
{ inherit system;
inputs', specialArgs =
self', recursiveUpdate
... {
}:
nixosSystem {
inherit system; inherit system;
specialArgs = inherit lib;
recursiveUpdate inherit inputs;
{ inherit self;
inherit lib;
inherit inputs inputs';
inherit self self';
}
(args.specialArgs or {});
modules = concatLists [
# This is used to pre-emptively set the hostPlatform for nixpkgs.
# Also, we set the system hostname here.
(singleton {
networking.hostName = args.hostname;
nixpkgs.hostPlatform = mkDefault args.system;
})
(flatten (
concatLists [
(singleton ./${hostname}/default.nix)
(
filter (hasSuffix "module.nix") (
map toString (listFilesRecursive ../modules)
)
)
]
))
];
} }
); (args.specialArgs or {});
modules = concatLists [
# This is used to pre-emptively set the hostPlatform for nixpkgs.
# Also, we set the system hostname here.
(singleton {
networking.hostName = args.hostname;
nixpkgs.hostPlatform = mkDefault args.system;
})
(flatten (
concatLists [
(singleton ./${hostname}/default.nix)
(
filter (hasSuffix "module.nix") (
map toString (listFilesRecursive ../modules)
)
)
]
))
];
};
in { in {
flake.nixosConfigurations = { temperance = mkSystem {
temperance = mkSystem { system = "x86_64-linux";
inherit withSystem; hostname = "temperance";
system = "x86_64-linux"; };
hostname = "temperance";
};
hermit = mkSystem { hermit = mkSystem {
inherit withSystem; system = "x86_64-linux";
system = "x86_64-linux"; hostname = "hermit";
hostname = "hermit";
};
}; };
} }

View file

@ -1,10 +1,4 @@
{ {pkgs, ...}: {
inputs',
pkgs,
...
}: let
inherit (inputs'.nixpkgs-stable.legacyPackages) calibre;
in {
environment.systemPackages = with pkgs; environment.systemPackages = with pkgs;
[ [
alsa-utils alsa-utils
@ -12,6 +6,7 @@ in {
asciinema asciinema
cachix cachix
calc calc
calibre
difftastic difftastic
element-desktop element-desktop
evince evince
@ -63,6 +58,5 @@ in {
xournalpp xournalpp
zapzap zapzap
zoxide zoxide
] ];
++ [calibre];
} }

View file

@ -1,5 +1,4 @@
{ {
inputs',
config, config,
pkgs, pkgs,
lib, lib,

View file

@ -1,6 +1,6 @@
{ {
config, config,
inputs', inputs,
lib, lib,
pkgs, pkgs,
... ...
@ -8,7 +8,7 @@
cfg = config.modules.system.programs.editors.helix; cfg = config.modules.system.programs.editors.helix;
inherit (config.modules.other.system) username; inherit (config.modules.other.system) username;
inherit (lib) mkIf getExe; inherit (lib) mkIf getExe;
inherit (inputs'.helix.packages) helix; inherit (inputs.helix.packages.${pkgs.stdenv.system}) helix;
wrapped-helix = pkgs.symlinkJoin { wrapped-helix = pkgs.symlinkJoin {
name = "helix-wrapped"; name = "helix-wrapped";
paths = with pkgs; [ paths = with pkgs; [

View file

@ -1,10 +1,9 @@
{ {
inputs, inputs,
inputs',
pkgs, pkgs,
... ...
}: let }: let
spicePkgs = inputs'.spicetify-nix.legacyPackages; spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.stdenv.system};
in { in {
imports = [ imports = [
inputs.spicetify-nix.nixosModules.default inputs.spicetify-nix.nixosModules.default

View file

@ -1,6 +1,5 @@
{ {
config, config,
inputs',
lib, lib,
pkgs, pkgs,
... ...

View file

@ -1,6 +1,5 @@
{ {
config, config,
inputs',
lib, lib,
pkgs, pkgs,
... ...

View file

@ -1,11 +1,11 @@
{ {
config, config,
lib, lib,
inputs', inputs,
pkgs, pkgs,
... ...
}: let }: let
inherit (inputs') quickshell; inherit (inputs) quickshell;
inherit (lib.generators) toKeyValue; inherit (lib.generators) toKeyValue;
inherit (config.meta.mainUser) username; inherit (config.meta.mainUser) username;
in { in {
@ -13,7 +13,7 @@ in {
home.packages = with pkgs; [ home.packages = with pkgs; [
qt6.qtimageformats # amog qt6.qtimageformats # amog
qt6.qt5compat # shader fx qt6.qt5compat # shader fx
(quickshell.packages.default.override { (quickshell.packages.x86_64-linux.default.override {
withJemalloc = true; withJemalloc = true;
withQtSvg = true; withQtSvg = true;
withX11 = true; withX11 = true;

View file

@ -2,12 +2,11 @@
config, config,
pkgs, pkgs,
lib, lib,
inputs',
... ...
}: let }: let
cfg = config.modules.usrEnv.desktops.hyprland; cfg = config.modules.usrEnv.desktops.hyprland;
inherit (config.meta.mainUser) username; inherit (config.meta.mainUser) username;
inherit (inputs'.hyprsplit.packages) hyprsplit; # inherit (inputs.hyprsplit.packages.${pkgs.system}) hyprsplit;
inherit (lib) mkIf mkDefault; inherit (lib) mkIf mkDefault;
in { in {
imports = [ imports = [