192: flake: nixos -> nixos-unstable r=nrdxp a=nrdxp

20.09 is getting stale as we move toward a new release so track unstable for now.

Co-authored-by: Timothy DeHerrera <tim.deh@pm.me>
This commit is contained in:
bors[bot] 2021-03-23 06:10:34 +00:00 committed by GitHub
commit c667cc5097
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 46 additions and 121 deletions

1
extern/default.nix vendored
View file

@ -9,7 +9,6 @@ in
]; ];
overlays = [ overlays = [
nix.overlay
nur.overlay nur.overlay
devshell.overlay devshell.overlay
(final: prev: { (final: prev: {

View file

@ -17,11 +17,11 @@
"pre-commit-hooks-nix": "pre-commit-hooks-nix" "pre-commit-hooks-nix": "pre-commit-hooks-nix"
}, },
"locked": { "locked": {
"lastModified": 1614270488, "lastModified": 1615131736,
"narHash": "sha256-WC7qF0BYB7RdfnEPk9du029bkxhbNTw4MAOpYDm1KNI=", "narHash": "sha256-z4Er9Cj3WpBDO/saLxqb7IypEvVP0/1AnO6rY5NB03Y=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "hercules-ci-agent", "repo": "hercules-ci-agent",
"rev": "6adf883b66f9dcfe8b9a44e689b1ac7819077bde", "rev": "a1513a51e8efb96e990a562e6e724e17f2789978",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -139,11 +139,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1614333665, "lastModified": 1614785451,
"narHash": "sha256-6y22hmT4iWY1v5uggGhrH22QDZxBnsfO5+83s9mb1Js=", "narHash": "sha256-TPw8kQvr2UNCuvndtY+EjyXp6Q5GEW2l9UafXXh1XmI=",
"owner": "nmattia", "owner": "nmattia",
"repo": "naersk", "repo": "naersk",
"rev": "a2a4b60a9ed541794906977be771b9cfe325d57a", "rev": "e0fe990b478a66178a58c69cf53daec0478ca6f9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -152,47 +152,28 @@
"type": "github" "type": "github"
} }
}, },
"nix": {
"inputs": {
"nixpkgs": [
"nixos"
]
},
"locked": {
"lastModified": 1615476733,
"narHash": "sha256-iae4JMAl2KAaPhUGLMf4/DEejWjs5fWfEU1ccVF8s6Q=",
"owner": "NixOS",
"repo": "nix",
"rev": "8127094f767b6caae145bc395a504ca62f30af3e",
"type": "github"
},
"original": {
"id": "nix",
"type": "indirect"
}
},
"nixos": { "nixos": {
"locked": { "locked": {
"lastModified": 1614531331, "lastModified": 1615797423,
"narHash": "sha256-/69RG5ZI84MMN+ZD99A+MtPzyNDtwfcEFIUsuijwQPw=", "narHash": "sha256-5NGDZXPQzuoxf/42NiyC9YwwhwzfMfIRrz3aT0XHzSc=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "df8e3bd110921621d175fad88c9e67909b7cb3d3", "rev": "266dc8c3d052f549826ba246d06787a219533b8f",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "id": "nixpkgs",
"ref": "release-20.09", "ref": "nixos-unstable",
"type": "indirect" "type": "indirect"
} }
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1614460257, "lastModified": 1615652054,
"narHash": "sha256-hFR865O5gIuFNiwFyx/K2g8AeLvGy/f3/SHalF85zuM=", "narHash": "sha256-jqXKU8Ovpi7MmPRqGf2FB3QOPcZtGwO2MFc0AYiOPjg=",
"owner": "nixos", "owner": "nixos",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "c9b965a43e582765f797f8b75d50cb2874b30f30", "rev": "31f61b90ddb9257b94888ee17ccf96236e180c76",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -203,11 +184,11 @@
}, },
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1614639970, "lastModified": 1615921934,
"narHash": "sha256-RM2s9f7UPCzTHm1J5q1iI1RGytw5CwLOj4cnEGwYWos=", "narHash": "sha256-nURGM869KKA1+c1SHHsXKYcPXhHIuxWBjNXjJ90OzRQ=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "f5f8df943c5e9cb722fc56ea79f1c688de7d26bd", "rev": "faf862e8cf009edfa38ecc61188f7a6ace293552",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -217,11 +198,11 @@
}, },
"override": { "override": {
"locked": { "locked": {
"lastModified": 1614652644, "lastModified": 1615926763,
"narHash": "sha256-/XTMCbKcbTHf96KL+eAal6FrnLAtUAuJPPrDU9Ze9J0=", "narHash": "sha256-yeq8A3EPNuQVlsxlEQrIRsklfJwJK0Us6jtcG/u8wNs=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "66d7cb4fa8b583f120e25bc86a2f5f2345f3b976", "rev": "b702a56d417647de4090ac56c0f18bdc7e646610",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -236,7 +217,7 @@
] ]
}, },
"locked": { "locked": {
"narHash": "sha256-sBVaeGxxs7sk7PodW1mqJbF0CqUqUar0GUdd+OPnZ8o=", "narHash": "sha256-XG4TOZObj2Wd8KiqnHgtlWjjMbJOIJB7+DxUFzMCXw8=",
"path": "./pkgs", "path": "./pkgs",
"type": "path" "type": "path"
}, },
@ -270,7 +251,6 @@
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
"home": "home", "home": "home",
"naersk": "naersk", "naersk": "naersk",
"nix": "nix",
"nixos": "nixos", "nixos": "nixos",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nur": "nur", "nur": "nur",

View file

@ -3,7 +3,7 @@
inputs = inputs =
{ {
nixos.url = "nixpkgs/release-20.09"; nixos.url = "nixpkgs/nixos-unstable";
override.url = "nixpkgs"; override.url = "nixpkgs";
ci-agent = { ci-agent = {
url = "github:hercules-ci/hercules-ci-agent"; url = "github:hercules-ci/hercules-ci-agent";
@ -22,14 +22,13 @@
home.inputs.nixpkgs.follows = "nixos"; home.inputs.nixpkgs.follows = "nixos";
naersk.url = "github:nmattia/naersk"; naersk.url = "github:nmattia/naersk";
naersk.inputs.nixpkgs.follows = "override"; naersk.inputs.nixpkgs.follows = "override";
nix.inputs.nixpkgs.follows = "nixos";
nixos-hardware.url = "github:nixos/nixos-hardware"; nixos-hardware.url = "github:nixos/nixos-hardware";
utils.url = "github:numtide/flake-utils/flatten-tree-system"; utils.url = "github:numtide/flake-utils/flatten-tree-system";
pkgs.url = "path:./pkgs"; pkgs.url = "path:./pkgs";
pkgs.inputs.nixpkgs.follows = "nixos"; pkgs.inputs.nixpkgs.follows = "nixos";
}; };
outputs = inputs@{ deploy, nixos, nur, nix, self, utils, ... }: outputs = inputs@{ deploy, nixos, nur, self, utils, ... }:
let let
inherit (self) lib; inherit (self) lib;
inherit (lib) os; inherit (lib) os;

View file

@ -13,6 +13,13 @@ let
suites = import ../suites { inherit lib; }; suites = import ../suites { inherit lib; };
experimentalFeatures = [
"flakes"
"nix-command"
"ca-references"
"ca-derivations"
];
modules = { modules = {
core = ../profiles/core; core = ../profiles/core;
modOverrides = { config, overrideModulesPath, ... }: modOverrides = { config, overrideModulesPath, ... }:
@ -47,6 +54,12 @@ let
override.flake = override; override.flake = override;
}; };
nix.extraOptions = ''
experimental-features = ${lib.concatStringsSep " "
experimentalFeatures
}
'';
system.configurationRevision = lib.mkIf (self ? rev) self.rev; system.configurationRevision = lib.mkIf (self ? rev) self.rev;
}; };

View file

@ -1,12 +0,0 @@
final: prev: {
nixFlakes = final.nix.overrideAttrs
(self:
let
oldPatches = self.patches or [ ];
in
{
patches = oldPatches ++ [
../pkgs/tools/package-management/nix/0001-nix-command-and-flakes-by-default.patch
];
});
}

View file

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1615769536, "lastModified": 1615926763,
"narHash": "sha256-oah5pb8kXyFa6ZcccvfREuY9VXHkUTNaoClXW7H1XUw=", "narHash": "sha256-yeq8A3EPNuQVlsxlEQrIRsklfJwJK0Us6jtcG/u8wNs=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "63a9f162355ec84c423690869a97848d73409fb8", "rev": "b702a56d417647de4090ac56c0f18bdc7e646610",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -1,28 +0,0 @@
From a47bbae869ff35095eb2fe4d4d5145054ea81049 Mon Sep 17 00:00:00 2001
From: Timothy DeHerrera <tim.deh@pm.me>
Date: Wed, 17 Feb 2021 12:26:48 -0700
Subject: [PATCH] nix-command and flakes by default
---
src/libstore/globals.hh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
index eabd83e3f..e851e2a79 100644
--- a/src/libstore/globals.hh
+++ b/src/libstore/globals.hh
@@ -889,7 +889,10 @@ public:
value.
)"};
- Setting<Strings> experimentalFeatures{this, {}, "experimental-features",
+ Setting<Strings> experimentalFeatures{
+ this,
+ {"nix-command", "flakes", "ca-references"},
+ "experimental-features",
"Experimental Nix features to enable."};
bool isExperimentalFeatureEnabled(const std::string & name);
--
2.28.0

View file

@ -22,7 +22,6 @@ pkgs.devshell.mkShell
nixos-install nixos-install
nixos-generate-config nixos-generate-config
nixos-enter nixos-enter
pkgs.nixFlakes
]; ];
git.hooks = { git.hooks = {
@ -30,8 +29,13 @@ pkgs.devshell.mkShell
}; };
commands = with pkgs; [ commands = with pkgs; [
{ package = flk; }
{ {
package = flk; name = "nix";
help = pkgs.nixFlakes.meta.description;
command = ''
${pkgs.nixFlakes}/bin/nix --experimental-features "nix-command flakes ca-references" "${"\${@}"}"
'';
} }
] ]
++ lib.optional (system != "i686-linux") { package = cachix; } ++ lib.optional (system != "i686-linux") { package = cachix; }

View file

@ -17,7 +17,7 @@ usage () {
printf " %-30s %s\n\n" \ printf " %-30s %s\n\n" \
"up" "Generate $DEVSHELL_ROOT/hosts/up-$HOSTNAME.nix" \ "up" "Generate $DEVSHELL_ROOT/hosts/up-$HOSTNAME.nix" \
"update [INPUT]" "Update and commit the lock file" \ "update [INPUT]" "Update and commit the lock file, or specific input" \
"get (core|community) [DEST]" "Copy the desired template to DEST" \ "get (core|community) [DEST]" "Copy the desired template to DEST" \
"iso HOST" "Generate an ISO image of HOST" \ "iso HOST" "Generate an ISO image of HOST" \
"install HOST [ARGS]" "Shortcut for nixos-install" \ "install HOST [ARGS]" "Shortcut for nixos-install" \

View file

@ -3,40 +3,10 @@ let
inherit (self.inputs) nixos; inherit (self.inputs) nixos;
inherit (self.nixosConfigurations.NixOS.config.lib) testModule specialArgs; inherit (self.nixosConfigurations.NixOS.config.lib) testModule specialArgs;
# current release 20.09 does not support the specialArgs required for us
# to use tests as we would normally use hosts. Using the "testing-python.nix"
# from the override flake would build the test-vm from an unstable os
# different than the one our systems are running. Instead simply patch nixpkgs
# to include the updated version. This can be removed in the next release
patchedNixpkgs =
pkgs.stdenv.mkDerivation {
name = "nixpkgs-patched";
src = nixos;
patches = [ ./0004-nixos-testing-Add-support-for-specialArgs.patch ];
dontBuild = true;
dontFixup = true;
versionSuffix = "pre${
if nixos ? lastModified
then builtins.substring 0 8 (nixos.lastModifiedDate or nixos.lastModified)
else toString nixos.revCount}.${nixos.shortRev or "dirty"}";
configurePhase = ''
echo -n $VERSION_SUFFIX > .version-suffix
echo -n ${nixos.rev or nixos.shortRev or "dirty"} > .git-revision
'';
installPhase = ''
cp -r $PWD $out
'';
};
mkTest = mkTest =
let let
nixosTesting = nixosTesting =
(import "${patchedNixpkgs}/nixos/lib/testing-python.nix" { (import "${nixos}/nixos/lib/testing-python.nix" {
inherit (pkgs.stdenv.hostPlatform) system; inherit (pkgs.stdenv.hostPlatform) system;
inherit specialArgs; inherit specialArgs;
inherit pkgs; inherit pkgs;