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:
parent
068be3f5bf
commit
5e0ca31d02
64
flake.lock
64
flake.lock
@ -19,6 +19,36 @@
|
||||
"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": {
|
||||
"locked": {
|
||||
"lastModified": 1591748508,
|
||||
@ -33,41 +63,11 @@
|
||||
"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": {
|
||||
"inputs": {
|
||||
"home": "home",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"unstable": "unstable"
|
||||
}
|
||||
},
|
||||
"unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1596085265,
|
||||
"narHash": "sha256-GvvEdlmQHmt9S/yrInyJ/unOSlcTHjHoOC4LcOvzATM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "4701e11216560f85e7b2ecf215e592ff9a46c41b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "master",
|
||||
"type": "indirect"
|
||||
"master": "master",
|
||||
"nixos": "nixos"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
29
flake.nix
29
flake.nix
@ -1,14 +1,17 @@
|
||||
{
|
||||
description = "A highly structured configuration database.";
|
||||
|
||||
inputs.nixpkgs.url = "nixpkgs/release-20.03";
|
||||
inputs.unstable.url = "nixpkgs/master";
|
||||
inputs.home.url = "github:rycee/home-manager/bqv-flakes";
|
||||
inputs =
|
||||
{
|
||||
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
|
||||
inherit (builtins) attrNames attrValues readDir;
|
||||
inherit (nixpkgs) lib;
|
||||
inherit (nixos) lib;
|
||||
inherit (lib) removeSuffix recursiveUpdate;
|
||||
inherit (utils) pathsToImportedAttrs;
|
||||
|
||||
@ -23,19 +26,23 @@
|
||||
config = { allowUnfree = true; };
|
||||
};
|
||||
|
||||
pkgs = pkgImport nixpkgs;
|
||||
unstablePkgs = pkgImport unstable;
|
||||
pkgset = {
|
||||
osPkgs = pkgImport nixos;
|
||||
pkgs = pkgImport master;
|
||||
};
|
||||
|
||||
in
|
||||
with pkgset;
|
||||
{
|
||||
nixosConfigurations =
|
||||
import ./hosts (recursiveUpdate inputs {
|
||||
inherit system pkgs
|
||||
unstablePkgs utils;
|
||||
inherit lib pkgset system utils;
|
||||
}
|
||||
);
|
||||
|
||||
devShell."${system}" = import ./shell.nix { inherit pkgs; };
|
||||
devShell."${system}" = import ./shell.nix {
|
||||
inherit pkgs;
|
||||
};
|
||||
|
||||
overlay = import ./pkgs;
|
||||
|
||||
@ -47,7 +54,7 @@
|
||||
in
|
||||
pathsToImportedAttrs overlayPaths;
|
||||
|
||||
packages."${system}" = self.overlay pkgs pkgs;
|
||||
packages."${system}" = (self.overlay osPkgs osPkgs);
|
||||
|
||||
nixosModules =
|
||||
let
|
||||
|
@ -1,8 +1,17 @@
|
||||
{ home, nixpkgs, unstable, unstablePkgs, self, pkgs, system, utils, ... }:
|
||||
{ home
|
||||
, lib
|
||||
, nixos
|
||||
, master
|
||||
, pkgset
|
||||
, self
|
||||
, system
|
||||
, utils
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
inherit (utils) recImport;
|
||||
inherit (builtins) attrValues removeAttrs;
|
||||
inherit (pkgset) osPkgs pkgs;
|
||||
|
||||
config = hostName:
|
||||
lib.nixosSystem {
|
||||
@ -16,31 +25,36 @@ let
|
||||
|
||||
global = {
|
||||
networking.hostName = hostName;
|
||||
nix.nixPath = [
|
||||
"nixpkgs=${nixpkgs}"
|
||||
"nixos-config=/etc/nixos/configuration.nix"
|
||||
"nixpkgs-overlays=/etc/nixos/overlays"
|
||||
nix.nixPath = let path = toString ../.; in
|
||||
[
|
||||
"nixpkgs=${master}"
|
||||
"nixos=${nixos}"
|
||||
"nixos-config=${path}/configuration.nix"
|
||||
"nixpkgs-overlays=${path}/overlays"
|
||||
];
|
||||
|
||||
nixpkgs = { inherit pkgs; };
|
||||
nixpkgs = { pkgs = osPkgs; };
|
||||
|
||||
nix.registry = {
|
||||
nixpkgs.flake = nixpkgs;
|
||||
nixos.flake = nixos;
|
||||
nixflk.flake = self;
|
||||
master.flake = unstable;
|
||||
nixpkgs.flake = master;
|
||||
};
|
||||
};
|
||||
|
||||
unstables = {
|
||||
systemd.package = unstablePkgs.systemd;
|
||||
nixpkgs.overlays = [
|
||||
(final: prev:
|
||||
with unstablePkgs; {
|
||||
inherit starship element-desktop discord signal-desktop mpv
|
||||
protonvpn-cli-ng dhall nixpkgs-fmt;
|
||||
}
|
||||
)
|
||||
];
|
||||
overrides = {
|
||||
# use latest systemd
|
||||
systemd.package = pkgs.systemd;
|
||||
|
||||
nixpkgs.overlays =
|
||||
let
|
||||
override = import ../pkgs/override.nix pkgs;
|
||||
|
||||
overlay = pkg: final: prev: {
|
||||
inherit pkg;
|
||||
};
|
||||
in
|
||||
map overlay override;
|
||||
};
|
||||
|
||||
local = import "${toString ./.}/${hostName}.nix";
|
||||
@ -50,7 +64,7 @@ let
|
||||
attrValues (removeAttrs self.nixosModules [ "profiles" ]);
|
||||
|
||||
in
|
||||
flakeModules ++ [ core global local home-manager unstables ];
|
||||
flakeModules ++ [ core global local home-manager overrides ];
|
||||
|
||||
};
|
||||
|
||||
|
15
pkgs/override.nix
Normal file
15
pkgs/override.nix
Normal 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
|
||||
]
|
Loading…
Reference in New Issue
Block a user