flake.nix: switch to flake parts
Currently, there has been no functional change to the structure of this flake. I have simply wrapped the current flake outputs in the root flake-parts module.
This commit is contained in:
parent
6975b56de2
commit
63c5fd0f6a
33
flake.lock
generated
33
flake.lock
generated
@ -273,6 +273,24 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-parts": {
|
"flake-parts": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1738453229,
|
||||||
|
"narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-parts_2": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs-lib": [
|
"nixpkgs-lib": [
|
||||||
"lanzaboote",
|
"lanzaboote",
|
||||||
@ -966,7 +984,7 @@
|
|||||||
"inputs": {
|
"inputs": {
|
||||||
"crane": "crane",
|
"crane": "crane",
|
||||||
"flake-compat": "flake-compat_2",
|
"flake-compat": "flake-compat_2",
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts_2",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
@ -1113,6 +1131,18 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs-lib": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1738452942,
|
||||||
|
"narHash": "sha256-vJzFZGaCpnmo7I6i416HaBLpC+hvcURh/BQwROcGIp8=",
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs-nix-du": {
|
"nixpkgs-nix-du": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1722785290,
|
"lastModified": 1722785290,
|
||||||
@ -1231,6 +1261,7 @@
|
|||||||
"inputs": {
|
"inputs": {
|
||||||
"agenix": "agenix",
|
"agenix": "agenix",
|
||||||
"base16": "base16",
|
"base16": "base16",
|
||||||
|
"flake-parts": "flake-parts",
|
||||||
"home-manager": "home-manager_2",
|
"home-manager": "home-manager_2",
|
||||||
"home-manager-unstable": "home-manager-unstable",
|
"home-manager-unstable": "home-manager-unstable",
|
||||||
"hypridle": "hypridle",
|
"hypridle": "hypridle",
|
||||||
|
181
flake.nix
181
flake.nix
@ -11,6 +11,8 @@
|
|||||||
# this seems to be a popular way to declare systems
|
# this seems to be a popular way to declare systems
|
||||||
systems.url = "github:nix-systems/default";
|
systems.url = "github:nix-systems/default";
|
||||||
|
|
||||||
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
|
|
||||||
home-manager = {
|
home-manager = {
|
||||||
url = "github:nix-community/home-manager/release-23.11";
|
url = "github:nix-community/home-manager/release-23.11";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
@ -102,8 +104,17 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, nixpkgs-unstable, ... }@inputs:
|
outputs = {
|
||||||
let
|
self,
|
||||||
|
flake-parts,
|
||||||
|
...
|
||||||
|
} @ inputs:
|
||||||
|
flake-parts.lib.mkFlake {inherit inputs;} ({
|
||||||
|
inputs,
|
||||||
|
self,
|
||||||
|
...
|
||||||
|
} @ flakeArgs: let
|
||||||
|
inherit (inputs) nixpkgs nixpkgs-unstable;
|
||||||
inherit (self) outputs;
|
inherit (self) outputs;
|
||||||
# inputs is already defined
|
# inputs is already defined
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
@ -113,7 +124,8 @@
|
|||||||
nix-minecraft-patched-overlay = let
|
nix-minecraft-patched-overlay = let
|
||||||
normal = inputs.nix-minecraft-upstream.overlays.default;
|
normal = inputs.nix-minecraft-upstream.overlays.default;
|
||||||
quilt = inputs.nix-minecraft.overlays.default;
|
quilt = inputs.nix-minecraft.overlays.default;
|
||||||
in lib.composeExtensions
|
in
|
||||||
|
lib.composeExtensions
|
||||||
normal
|
normal
|
||||||
(final: prev: let
|
(final: prev: let
|
||||||
x = quilt final prev;
|
x = quilt final prev;
|
||||||
@ -162,29 +174,40 @@
|
|||||||
# This function produces a module that adds the home-manager module to the
|
# This function produces a module that adds the home-manager module to the
|
||||||
# system and configures the given module to the user's Home Manager
|
# system and configures the given module to the user's Home Manager
|
||||||
# configuration
|
# configuration
|
||||||
homeManagerInit = let _username=username; _nixpkgs=nixpkgs;
|
homeManagerInit = let
|
||||||
in { system,
|
_username = username;
|
||||||
|
_nixpkgs = nixpkgs;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
system,
|
||||||
nixpkgs ? _nixpkgs, # this is so modules can know which flake the system is using
|
nixpkgs ? _nixpkgs, # this is so modules can know which flake the system is using
|
||||||
home-manager ? inputs.home-manager,
|
home-manager ? inputs.home-manager,
|
||||||
username ? _username,
|
username ? _username,
|
||||||
module ? _: {},
|
module ? _: {},
|
||||||
rootModule ? (import ./home/root.nix),
|
rootModule ? (import ./home/root.nix),
|
||||||
userModules ? { ${username} = [ module ] ; root = [ rootModule ]; },
|
userModules ? {
|
||||||
stateVersion }:
|
${username} = [module];
|
||||||
{ config, lib, pkgs, ... }:
|
root = [rootModule];
|
||||||
let
|
},
|
||||||
mapUserModules = lib.attrsets.mapAttrs (user: modules: {...}:
|
stateVersion,
|
||||||
{
|
}: {
|
||||||
imports = [
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
mapUserModules = lib.attrsets.mapAttrs (user: modules: {...}: {
|
||||||
|
imports =
|
||||||
|
[
|
||||||
./home
|
./home
|
||||||
] ++ modules;
|
]
|
||||||
|
++ modules;
|
||||||
config = {
|
config = {
|
||||||
home = {inherit stateVersion;};
|
home = {inherit stateVersion;};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
users = mapUserModules userModules;
|
users = mapUserModules userModules;
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
imports = [
|
imports = [
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
];
|
];
|
||||||
@ -206,7 +229,9 @@
|
|||||||
mkSystemN = let
|
mkSystemN = let
|
||||||
_username = username;
|
_username = username;
|
||||||
_overlays = overlays;
|
_overlays = overlays;
|
||||||
in { nixpkgs ? inputs.nixpkgs,
|
in
|
||||||
|
{
|
||||||
|
nixpkgs ? inputs.nixpkgs,
|
||||||
home-manager ? inputs.home-manager,
|
home-manager ? inputs.home-manager,
|
||||||
username ? _username,
|
username ? _username,
|
||||||
entrypoint ? ./system,
|
entrypoint ? ./system,
|
||||||
@ -215,31 +240,49 @@
|
|||||||
config ? {},
|
config ? {},
|
||||||
overlays ? _overlays,
|
overlays ? _overlays,
|
||||||
system,
|
system,
|
||||||
... }@args: let
|
...
|
||||||
_modules = [ entrypoint config ] ++ modules ++ [{
|
} @ args: let
|
||||||
|
_modules =
|
||||||
|
[entrypoint config]
|
||||||
|
++ modules
|
||||||
|
++ [
|
||||||
|
{
|
||||||
nixpkgs.config = {
|
nixpkgs.config = {
|
||||||
inherit overlays;
|
inherit overlays;
|
||||||
allowUnfree = true;
|
allowUnfree = true;
|
||||||
};
|
};
|
||||||
}] ++ lib.optional (args ? stateVersion) { config.system.stateVersion = stateVersion; };
|
}
|
||||||
in nixpkgs.lib.nixosSystem {
|
]
|
||||||
|
++ lib.optional (args ? stateVersion) {config.system.stateVersion = stateVersion;};
|
||||||
|
in
|
||||||
|
nixpkgs.lib.nixosSystem {
|
||||||
};
|
};
|
||||||
mkSystem = let _username=username; _overlays=overlays; _nixpkgs=nixpkgs;
|
mkSystem = let
|
||||||
in { system,
|
_username = username;
|
||||||
|
_overlays = overlays;
|
||||||
|
_nixpkgs = nixpkgs;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
system,
|
||||||
nixpkgs ? _nixpkgs,
|
nixpkgs ? _nixpkgs,
|
||||||
home-manager ? inputs.home-manager,
|
home-manager ? inputs.home-manager,
|
||||||
overlays ? _overlays,
|
overlays ? _overlays,
|
||||||
hostname,
|
hostname,
|
||||||
username ? _username,
|
username ? _username,
|
||||||
stateVersion,
|
stateVersion,
|
||||||
extraModules ? [] }:
|
extraModules ? [],
|
||||||
|
}:
|
||||||
nixpkgs.lib.nixosSystem {
|
nixpkgs.lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
modules = [
|
modules =
|
||||||
|
[
|
||||||
./system
|
./system
|
||||||
({pkgs, config, lib, ...}@args:
|
({
|
||||||
{
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
} @ args: {
|
||||||
# Values for every single system that would not conceivably need
|
# Values for every single system that would not conceivably need
|
||||||
# to be made modular
|
# to be made modular
|
||||||
system.stateVersion = stateVersion;
|
system.stateVersion = stateVersion;
|
||||||
@ -258,14 +301,21 @@
|
|||||||
module = import ./hosts/${hostname}/home.nix;
|
module = import ./hosts/${hostname}/home.nix;
|
||||||
inherit username system stateVersion;
|
inherit username system stateVersion;
|
||||||
})
|
})
|
||||||
] ++ extraModules;
|
]
|
||||||
|
++ extraModules;
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit inputs outputs vars nixpkgs home-manager;
|
inherit inputs outputs vars nixpkgs home-manager;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
mkWSLSystem = let _username=username; in
|
mkWSLSystem = let
|
||||||
{username ? _username, extraModules ? [], ...}@args: let
|
_username = username;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
username ? _username,
|
||||||
|
extraModules ? [],
|
||||||
|
...
|
||||||
|
} @ args: let
|
||||||
WSLModule = {...}: {
|
WSLModule = {...}: {
|
||||||
imports = [
|
imports = [
|
||||||
inputs.nix-wsl.nixosModules.wsl
|
inputs.nix-wsl.nixosModules.wsl
|
||||||
@ -277,12 +327,17 @@
|
|||||||
in
|
in
|
||||||
mkSystem (args // override);
|
mkSystem (args // override);
|
||||||
|
|
||||||
mkISOSystem = system: inputs.nixpkgs-unstable.lib.nixosSystem {
|
mkISOSystem = system:
|
||||||
|
inputs.nixpkgs-unstable.lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
modules = [
|
modules = [
|
||||||
"${inputs.nixpkgs-unstable}/nixos/modules/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix"
|
"${inputs.nixpkgs-unstable}/nixos/modules/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix"
|
||||||
({ config, pkgs, lib, ... }:
|
({
|
||||||
{
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
neovim
|
neovim
|
||||||
gparted
|
gparted
|
||||||
@ -301,7 +356,9 @@
|
|||||||
_home-manager = inputs.home-manager;
|
_home-manager = inputs.home-manager;
|
||||||
_nixpkgs = inputs.nixpkgs;
|
_nixpkgs = inputs.nixpkgs;
|
||||||
_username = username;
|
_username = username;
|
||||||
in { home-manager ? _home-manager,
|
in
|
||||||
|
{
|
||||||
|
home-manager ? _home-manager,
|
||||||
nixpkgs ? _nixpkgs,
|
nixpkgs ? _nixpkgs,
|
||||||
username ? _username,
|
username ? _username,
|
||||||
homeDirectory ? "/home/${username}",
|
homeDirectory ? "/home/${username}",
|
||||||
@ -310,8 +367,13 @@
|
|||||||
stateVersion ? null,
|
stateVersion ? null,
|
||||||
config ? {},
|
config ? {},
|
||||||
system,
|
system,
|
||||||
... }@args: let
|
...
|
||||||
_modules = [ entrypoint ] ++ modules ++ [ config ] ++ [
|
} @ args: let
|
||||||
|
_modules =
|
||||||
|
[entrypoint]
|
||||||
|
++ modules
|
||||||
|
++ [config]
|
||||||
|
++ [
|
||||||
{
|
{
|
||||||
config = {
|
config = {
|
||||||
home = {
|
home = {
|
||||||
@ -322,8 +384,10 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
] ++ lib.optional (args ? stateVersion) { config.home.stateVersion = stateVersion; };
|
]
|
||||||
in home-manager.lib.homeManagerConfiguration ({
|
++ lib.optional (args ? stateVersion) {config.home.stateVersion = stateVersion;};
|
||||||
|
in
|
||||||
|
home-manager.lib.homeManagerConfiguration ({
|
||||||
modules = _modules;
|
modules = _modules;
|
||||||
pkgs = import nixpkgs {inherit system overlays;};
|
pkgs = import nixpkgs {inherit system overlays;};
|
||||||
|
|
||||||
@ -333,10 +397,11 @@
|
|||||||
# this is needed because modules don't use the default arg for some reason???
|
# this is needed because modules don't use the default arg for some reason???
|
||||||
osConfig = {};
|
osConfig = {};
|
||||||
};
|
};
|
||||||
} // builtins.removeAttrs args
|
}
|
||||||
|
// builtins.removeAttrs args
|
||||||
["system" "nixpkgs" "home-manager" "modules" "username" "homeDirectory" "stateVersion" "entrypoint" "config"]);
|
["system" "nixpkgs" "home-manager" "modules" "username" "homeDirectory" "stateVersion" "entrypoint" "config"]);
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
flake = {
|
||||||
# for repl debugging via :lf .
|
# for repl debugging via :lf .
|
||||||
inherit inputs vars;
|
inherit inputs vars;
|
||||||
|
|
||||||
@ -361,16 +426,26 @@
|
|||||||
# (extraS|s)pecialArgs to pass variables
|
# (extraS|s)pecialArgs to pass variables
|
||||||
nixosModules = (import ./modules/nixos) moduleInputs;
|
nixosModules = (import ./modules/nixos) moduleInputs;
|
||||||
homeManagerModules = (import ./modules/home-manager) moduleInputs;
|
homeManagerModules = (import ./modules/home-manager) moduleInputs;
|
||||||
packages = eachSystem (system: let pkgs = import nixpkgs-unstable { inherit system; };
|
packages = eachSystem (
|
||||||
in (
|
system: let
|
||||||
import ./pkgs { inherit pkgs; }) // {
|
pkgs = import nixpkgs-unstable {inherit system;};
|
||||||
|
in
|
||||||
|
(
|
||||||
|
import ./pkgs {inherit pkgs;}
|
||||||
|
)
|
||||||
|
// {
|
||||||
iso = let
|
iso = let
|
||||||
isoSystem = mkISOSystem system;
|
isoSystem = mkISOSystem system;
|
||||||
in isoSystem.config.system.build.isoImage;
|
in
|
||||||
|
isoSystem.config.system.build.isoImage;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
apps = eachSystem (system: import ./pkgs/apps.nix
|
apps = eachSystem (system:
|
||||||
{ inherit (self.outputs) packages; inherit system; });
|
import ./pkgs/apps.nix
|
||||||
|
{
|
||||||
|
inherit (self.outputs) packages;
|
||||||
|
inherit system;
|
||||||
|
});
|
||||||
|
|
||||||
overlays = import ./overlays self;
|
overlays = import ./overlays self;
|
||||||
|
|
||||||
@ -407,9 +482,11 @@
|
|||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
stateVersion = "24.11";
|
stateVersion = "24.11";
|
||||||
hostname = "rpi4";
|
hostname = "rpi4";
|
||||||
extraModules = [{
|
extraModules = [
|
||||||
|
{
|
||||||
nixpkgs.hostPlatform = "x86_64-linux";
|
nixpkgs.hostPlatform = "x86_64-linux";
|
||||||
}];
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
rpi4 = mkSystem {
|
rpi4 = mkSystem {
|
||||||
@ -477,5 +554,9 @@
|
|||||||
home-manager = inputs.home-manager-unstable;
|
home-manager = inputs.home-manager-unstable;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}; # end outputs
|
};
|
||||||
} # end flake
|
systems = (import inputs.systems);
|
||||||
|
}); # end outputs
|
||||||
|
}
|
||||||
|
# end flake
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user