Use flake-utils-plus
This commit is contained in:
parent
809457c8f9
commit
eb385040a7
3 changed files with 53 additions and 62 deletions
36
flake.lock
generated
36
flake.lock
generated
|
@ -27,7 +27,6 @@
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"ref": "master",
|
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
@ -54,16 +53,16 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1616250371,
|
"lastModified": 1616527350,
|
||||||
"narHash": "sha256-bG3/Dt3f/x8qUZ6djnfUVG8erVzwA9I4pxrtzmCizoI=",
|
"narHash": "sha256-VkMevY2WLU+K7T/P4wVj18Ms8zyeRfp05ILf556m5Y8=",
|
||||||
"owner": "chvp",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "e132ddfecfeba08f3b09b72064ded55b9fceb45a",
|
"rev": "d3f7e969b9860fb80750147aeb56dab1c730e756",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "chvp",
|
"owner": "nixos",
|
||||||
"ref": "master",
|
"ref": "nixos-unstable-small",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
@ -71,9 +70,28 @@
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"emacs-overlay": "emacs-overlay",
|
"emacs-overlay": "emacs-overlay",
|
||||||
"flake-utils": "flake-utils",
|
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs",
|
||||||
|
"utils": "utils"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"utils": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1616328024,
|
||||||
|
"narHash": "sha256-t5FrJlYiN1HojtN3eRWlPhmzH2+5pdB22AfosbphI6c=",
|
||||||
|
"owner": "gytis-ivaskevicius",
|
||||||
|
"repo": "flake-utils-plus",
|
||||||
|
"rev": "51cb739c9c9c2258bc70747eb7bc22975ae244bd",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "gytis-ivaskevicius",
|
||||||
|
"ref": "master",
|
||||||
|
"repo": "flake-utils-plus",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
59
flake.nix
59
flake.nix
|
@ -3,53 +3,36 @@
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
emacs-overlay.url = "github:nix-community/emacs-overlay/master";
|
emacs-overlay.url = "github:nix-community/emacs-overlay/master";
|
||||||
flake-utils.url = "github:numtide/flake-utils/master";
|
|
||||||
home-manager = {
|
home-manager = {
|
||||||
url = "github:nix-community/home-manager";
|
url = "github:nix-community/home-manager";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
nixpkgs.url = "github:chvp/nixpkgs/master";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable-small";
|
||||||
|
utils.url = "github:gytis-ivaskevicius/flake-utils-plus/master";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, emacs-overlay, nixpkgs, home-manager, flake-utils }:
|
outputs = inputs@{ self, nixpkgs, emacs-overlay, home-manager, utils }: utils.lib.systemFlake {
|
||||||
let
|
inherit self inputs;
|
||||||
version-suffix = nixpkgs.rev or (builtins.toString nixpkgs.lastModified);
|
channels.nixpkgs = {
|
||||||
pkgsFor = system: import nixpkgs {
|
input = nixpkgs;
|
||||||
inherit system;
|
patches = [ ];
|
||||||
|
# TODO: Try to find a way to get rid of this and return to the
|
||||||
|
# list built up in the config.
|
||||||
|
config = { allowUnfree = true; };
|
||||||
};
|
};
|
||||||
mkSystem = system: hostname: nixpkgs.lib.nixosSystem {
|
sharedOverlays = [ emacs-overlay.overlay ];
|
||||||
inherit system;
|
sharedModules = [
|
||||||
modules = [
|
utils.nixosModules.saneFlakeDefaults
|
||||||
({ pkgs, ... }: { nixpkgs.overlays = [ emacs-overlay.overlay ]; })
|
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
(./modules)
|
./modules
|
||||||
(./. + "/machines/${hostname}")
|
|
||||||
({ pkgs, ... }: {
|
|
||||||
environment.etc."nixpkgs".source = (pkgs.runCommandNoCC "nixpkgs" { } ''
|
|
||||||
cp -r ${nixpkgs} $out
|
|
||||||
chmod 700 $out
|
|
||||||
echo "${version-suffix}" > $out/.version-suffix
|
|
||||||
'');
|
|
||||||
nix.nixPath = [ "nixpkgs=/etc/nixpkgs" ];
|
|
||||||
})
|
|
||||||
];
|
];
|
||||||
|
nixosProfiles = {
|
||||||
|
kharbranth = { system = "x86_64-linux"; modules = [ ./machines/kharbranth ]; };
|
||||||
|
kholinar = { system = "x86_64-linux"; modules = [ ./machines/kholinar ]; };
|
||||||
|
lasting-integrity = { system = "x86_64-linux"; modules = [ ./machines/lasting-integrity ]; };
|
||||||
|
urithiru = { system = "x86_64-linux"; modules = [ ./machines/urithiru ]; };
|
||||||
};
|
};
|
||||||
in
|
devShellBuilder = channels:
|
||||||
flake-utils.lib.eachDefaultSystem
|
let pkgs = channels.nixpkgs; in pkgs.mkShell { buildInputs = [ pkgs.nixpkgs-fmt ]; };
|
||||||
(system:
|
|
||||||
let
|
|
||||||
pkgs = pkgsFor system;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
devShell = pkgs.mkShell {
|
|
||||||
buildInputs = with pkgs; [ nixpkgs-fmt ];
|
|
||||||
};
|
|
||||||
}) // {
|
|
||||||
nixosConfigurations = {
|
|
||||||
kharbranth = mkSystem "x86_64-linux" "kharbranth";
|
|
||||||
kholinar = mkSystem "x86_64-linux" "kholinar";
|
|
||||||
lasting-integrity = mkSystem "x86_64-linux" "lasting-integrity";
|
|
||||||
urithiru = mkSystem "x86_64-linux" "urithiru";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,10 +43,6 @@ in
|
||||||
default = true;
|
default = true;
|
||||||
example = false;
|
example = false;
|
||||||
};
|
};
|
||||||
enableFlakes = lib.mkOption {
|
|
||||||
default = true;
|
|
||||||
example = false;
|
|
||||||
};
|
|
||||||
unfreePackages = lib.mkOption {
|
unfreePackages = lib.mkOption {
|
||||||
default = [ ];
|
default = [ ];
|
||||||
example = [ "teams" ];
|
example = [ "teams" ];
|
||||||
|
@ -82,17 +78,11 @@ in
|
||||||
'' + (lib.optionalString config.chvp.nix.enableDirenv ''
|
'' + (lib.optionalString config.chvp.nix.enableDirenv ''
|
||||||
keep-outputs = true
|
keep-outputs = true
|
||||||
keep-derivations = true
|
keep-derivations = true
|
||||||
'') + (lib.optionalString config.chvp.nix.enableFlakes ''
|
|
||||||
experimental-features = nix-command flakes
|
|
||||||
'');
|
'');
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) config.chvp.nix.unfreePackages;
|
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) config.chvp.nix.unfreePackages;
|
||||||
nixpkgs.overlays = lib.mkIf config.chvp.nix.enableFlakes [
|
nixpkgs.overlays = [ (self: super: { nix = super.nixUnstable; }) ];
|
||||||
(self: super: {
|
|
||||||
nix = super.nixUnstable;
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
home-manager.users.charlotte = { ... }:
|
home-manager.users.charlotte = { ... }:
|
||||||
lib.recursiveUpdate
|
lib.recursiveUpdate
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue