flake: rename flake inputs and add overrides

Now you can add packages to the list in pkgs/override.nix and they will
be pulled in from nixpkgs master instead of the default NixOS flake
when installed.
This commit is contained in:
Timothy DeHerrera 2020-08-01 22:08:41 -06:00
parent 068be3f5bf
commit 5e0ca31d02
No known key found for this signature in database
GPG Key ID: 8985725DB5B0C122
4 changed files with 100 additions and 64 deletions

View File

@ -19,6 +19,36 @@
"type": "github" "type": "github"
} }
}, },
"master": {
"locked": {
"lastModified": 1596337980,
"narHash": "sha256-LyE4haB7x2SBb1AyFJwqtGQitdaBFyK2ov4eH9Agono=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "111221b93ad46bb7119686f0a89a7bf1d3ad5bd7",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "master",
"type": "indirect"
}
},
"nixos": {
"locked": {
"lastModified": 1596329181,
"narHash": "sha256-q6NSFQnFbpey/RP2LFfYW9Vcpt6CYKO8Q//6TuNBuYM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7dc4385dc7b5b2c0dbfecd774cebbc87ac05c061",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "release-20.03",
"type": "indirect"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1591748508, "lastModified": 1591748508,
@ -33,41 +63,11 @@
"type": "indirect" "type": "indirect"
} }
}, },
"nixpkgs_2": {
"locked": {
"lastModified": 1596030432,
"narHash": "sha256-Q5LNY71SXjEjhyzZ+cInbGu0reezV4LlXbRPe3jk7gk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "326767fd7309831974e6d7533593725897010c49",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "release-20.03",
"type": "indirect"
}
},
"root": { "root": {
"inputs": { "inputs": {
"home": "home", "home": "home",
"nixpkgs": "nixpkgs_2", "master": "master",
"unstable": "unstable" "nixos": "nixos"
}
},
"unstable": {
"locked": {
"lastModified": 1596085265,
"narHash": "sha256-GvvEdlmQHmt9S/yrInyJ/unOSlcTHjHoOC4LcOvzATM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4701e11216560f85e7b2ecf215e592ff9a46c41b",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "master",
"type": "indirect"
} }
} }
}, },

View File

@ -1,14 +1,17 @@
{ {
description = "A highly structured configuration database."; description = "A highly structured configuration database.";
inputs.nixpkgs.url = "nixpkgs/release-20.03"; inputs =
inputs.unstable.url = "nixpkgs/master"; {
inputs.home.url = "github:rycee/home-manager/bqv-flakes"; master.url = "nixpkgs/master";
nixos.url = "nixpkgs/release-20.03";
home.url = "github:rycee/home-manager/bqv-flakes";
};
outputs = inputs@{ self, home, nixpkgs, unstable }: outputs = inputs@{ self, home, nixos, master }:
let let
inherit (builtins) attrNames attrValues readDir; inherit (builtins) attrNames attrValues readDir;
inherit (nixpkgs) lib; inherit (nixos) lib;
inherit (lib) removeSuffix recursiveUpdate; inherit (lib) removeSuffix recursiveUpdate;
inherit (utils) pathsToImportedAttrs; inherit (utils) pathsToImportedAttrs;
@ -23,19 +26,23 @@
config = { allowUnfree = true; }; config = { allowUnfree = true; };
}; };
pkgs = pkgImport nixpkgs; pkgset = {
unstablePkgs = pkgImport unstable; osPkgs = pkgImport nixos;
pkgs = pkgImport master;
};
in in
with pkgset;
{ {
nixosConfigurations = nixosConfigurations =
import ./hosts (recursiveUpdate inputs { import ./hosts (recursiveUpdate inputs {
inherit system pkgs inherit lib pkgset system utils;
unstablePkgs utils;
} }
); );
devShell."${system}" = import ./shell.nix { inherit pkgs; }; devShell."${system}" = import ./shell.nix {
inherit pkgs;
};
overlay = import ./pkgs; overlay = import ./pkgs;
@ -47,7 +54,7 @@
in in
pathsToImportedAttrs overlayPaths; pathsToImportedAttrs overlayPaths;
packages."${system}" = self.overlay pkgs pkgs; packages."${system}" = (self.overlay osPkgs osPkgs);
nixosModules = nixosModules =
let let

View File

@ -1,8 +1,17 @@
{ home, nixpkgs, unstable, unstablePkgs, self, pkgs, system, utils, ... }: { home
, lib
, nixos
, master
, pkgset
, self
, system
, utils
, ...
}:
let let
inherit (nixpkgs) lib;
inherit (utils) recImport; inherit (utils) recImport;
inherit (builtins) attrValues removeAttrs; inherit (builtins) attrValues removeAttrs;
inherit (pkgset) osPkgs pkgs;
config = hostName: config = hostName:
lib.nixosSystem { lib.nixosSystem {
@ -16,31 +25,36 @@ let
global = { global = {
networking.hostName = hostName; networking.hostName = hostName;
nix.nixPath = [ nix.nixPath = let path = toString ../.; in
"nixpkgs=${nixpkgs}" [
"nixos-config=/etc/nixos/configuration.nix" "nixpkgs=${master}"
"nixpkgs-overlays=/etc/nixos/overlays" "nixos=${nixos}"
]; "nixos-config=${path}/configuration.nix"
"nixpkgs-overlays=${path}/overlays"
];
nixpkgs = { inherit pkgs; }; nixpkgs = { pkgs = osPkgs; };
nix.registry = { nix.registry = {
nixpkgs.flake = nixpkgs; nixos.flake = nixos;
nixflk.flake = self; nixflk.flake = self;
master.flake = unstable; nixpkgs.flake = master;
}; };
}; };
unstables = { overrides = {
systemd.package = unstablePkgs.systemd; # use latest systemd
nixpkgs.overlays = [ systemd.package = pkgs.systemd;
(final: prev:
with unstablePkgs; { nixpkgs.overlays =
inherit starship element-desktop discord signal-desktop mpv let
protonvpn-cli-ng dhall nixpkgs-fmt; override = import ../pkgs/override.nix pkgs;
}
) overlay = pkg: final: prev: {
]; inherit pkg;
};
in
map overlay override;
}; };
local = import "${toString ./.}/${hostName}.nix"; local = import "${toString ./.}/${hostName}.nix";
@ -50,7 +64,7 @@ let
attrValues (removeAttrs self.nixosModules [ "profiles" ]); attrValues (removeAttrs self.nixosModules [ "profiles" ]);
in in
flakeModules ++ [ core global local home-manager unstables ]; flakeModules ++ [ core global local home-manager overrides ];
}; };

15
pkgs/override.nix Normal file
View File

@ -0,0 +1,15 @@
# Packages in this list are imported by hosts/default.nix, and are pulled from
# nixpkgs master instead of the default nixos release. This doesn't actually
# install them, just creates an overlay to pull them from master if they are
# installed by the user elsewhere in the configuration.
pkgs:
with pkgs;
[
starship
element-desktop
discord
signal-desktop
mpv
dhall
nixpkgs-fmt
]