Skip to content

flake: nixos -> nixos-unstable #192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion extern/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ in
];

overlays = [
nix.overlay
nur.overlay
devshell.overlay
(final: prev: {
Expand Down
60 changes: 20 additions & 40 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

inputs =
{
nixos.url = "nixpkgs/release-20.09";
nixos.url = "nixpkgs/nixos-unstable";
override.url = "nixpkgs";
ci-agent = {
url = "github:hercules-ci/hercules-ci-agent";
Expand All @@ -22,14 +22,13 @@
home.inputs.nixpkgs.follows = "nixos";
naersk.url = "github:nmattia/naersk";
naersk.inputs.nixpkgs.follows = "override";
nix.inputs.nixpkgs.follows = "nixos";
nixos-hardware.url = "github:nixos/nixos-hardware";
utils.url = "github:numtide/flake-utils/flatten-tree-system";
pkgs.url = "path:./pkgs";
pkgs.inputs.nixpkgs.follows = "nixos";
};

outputs = inputs@{ deploy, nixos, nur, nix, self, utils, ... }:
outputs = inputs@{ deploy, nixos, nur, self, utils, ... }:
let
inherit (self) lib;
inherit (lib) os;
Expand Down
13 changes: 13 additions & 0 deletions hosts/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ let

suites = import ../suites { inherit lib; };

experimentalFeatures = [
"flakes"
"nix-command"
"ca-references"
"ca-derivations"
];

modules = {
core = ../profiles/core;
modOverrides = { config, overrideModulesPath, ... }:
Expand Down Expand Up @@ -47,6 +54,12 @@ let
override.flake = override;
};

nix.extraOptions = ''
experimental-features = ${lib.concatStringsSep " "
experimentalFeatures
}
'';

system.configurationRevision = lib.mkIf (self ? rev) self.rev;
};

Expand Down
12 changes: 0 additions & 12 deletions overlays/nixFlakes.nix

This file was deleted.

6 changes: 3 additions & 3 deletions pkgs/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

8 changes: 6 additions & 2 deletions shell/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,20 @@ pkgs.devshell.mkShell
nixos-install
nixos-generate-config
nixos-enter
pkgs.nixFlakes
];

git.hooks = {
pre-commit.text = lib.fileContents ./pre-commit.sh;
};

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; }
Expand Down
2 changes: 1 addition & 1 deletion shell/flk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ usage () {

printf " %-30s %s\n\n" \
"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" \
"iso HOST" "Generate an ISO image of HOST" \
"install HOST [ARGS]" "Shortcut for nixos-install" \
Expand Down
32 changes: 1 addition & 31 deletions tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,10 @@ let
inherit (self.inputs) nixos;
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 =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought removing this would fix multi-arch checks, but it looks like it still fails to evaluate x86-darwin. I think its because of passing system to the make-test-python function. Not really relevant to this PR, but tests could use a bit of reworking to improve multi-arch support.

Copy link
Collaborator Author

@nrdxp nrdxp Mar 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may not be a huge deal as darwin is currently disabled in ci for similar reasons. I'd like to invest in a decent mac at some point and run a separate CI runner on it to build these packages. For now we should probably filter it out of checks as we do with CI.

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 =
let
nixosTesting =
(import "${patchedNixpkgs}/nixos/lib/testing-python.nix" {
(import "${nixos}/nixos/lib/testing-python.nix" {
inherit (pkgs.stdenv.hostPlatform) system;
inherit specialArgs;
inherit pkgs;
Expand Down