nix: initial flake devshell

This commit is contained in:
Fiscal Velvet Poet 2022-07-19 08:20:05 +10:00
parent 85a6ed66bb
commit 0eacaed516
Signed by: fiscalvelvetpoet
GPG key ID: D8EBFD58B023BD47
7 changed files with 279 additions and 2 deletions

4
.envrc
View file

@ -1,2 +1,2 @@
use nix use flake
watch_file nix/* watch_file flake.nix

182
flake.lock Normal file
View file

@ -0,0 +1,182 @@
{
"nodes": {
"lowdown-src": {
"flake": false,
"locked": {
"lastModified": 1633514407,
"narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=",
"owner": "kristapsdz",
"repo": "lowdown",
"rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8",
"type": "github"
},
"original": {
"owner": "kristapsdz",
"repo": "lowdown",
"type": "github"
}
},
"nix": {
"inputs": {
"lowdown-src": "lowdown-src",
"nixpkgs": "nixpkgs",
"nixpkgs-regression": "nixpkgs-regression"
},
"locked": {
"lastModified": 1657886512,
"narHash": "sha256-B9EyDUz/9tlcWwf24lwxCFmkxuPTVW7HFYvp0C4xGbc=",
"owner": "NixOS",
"repo": "nix",
"rev": "0b62dab6db3da5b20e62697b14aaaf80f1a2eea6",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "2.10.3",
"repo": "nix",
"type": "github"
}
},
"nixops": {
"inputs": {
"nixpkgs": "nixpkgs_2",
"utils": "utils"
},
"locked": {
"lastModified": 1657388807,
"narHash": "sha256-MtTM5KUHIDqnY254chIOp00EmsbYsXR3mXrnbbY4wg0=",
"owner": "NixOS",
"repo": "nixops",
"rev": "dcafae5258773dc0fbdd31b425f1ad3fb59173fe",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "master",
"repo": "nixops",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1657693803,
"narHash": "sha256-G++2CJ9u0E7NNTAi9n5G8TdDmGJXcIjkJ3NF8cetQB8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "365e1b3a859281cf11b94f87231adeabbdd878a2",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-22.05-small",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-regression": {
"locked": {
"lastModified": 1643052045,
"narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
"type": "github"
}
},
"nixpkgsUnstable": {
"locked": {
"lastModified": 1658103945,
"narHash": "sha256-1/kQlzKGt1563JZ+gIlNHU6rEbaDh2KopZLJ4CzraWI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2e3f6efdeda4cfff0259912495761885d8bee74a",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1656753965,
"narHash": "sha256-BCrB3l0qpJokOnIVc3g2lHiGhnjUi0MoXiw6t1o8H1E=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0ea7a8f1b939d74e5df8af9a8f7342097cdf69eb",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1657972522,
"narHash": "sha256-JTiKsBT1BwMbtSUsvtSl8ffkiirby8FaujJVGV766Q8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "07a2e6a4e31ea48408861607198972d60adaf4ad",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-22.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nix": "nix",
"nixops": "nixops",
"nixpkgs": "nixpkgs_3",
"nixpkgsUnstable": "nixpkgsUnstable",
"utils": "utils_2"
}
},
"utils": {
"locked": {
"lastModified": 1634851050,
"narHash": "sha256-N83GlSGPJJdcqhUxSCS/WwW5pksYf3VP1M13cDRTSVA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c91f3de5adaf1de973b797ef7485e441a65b8935",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"utils_2": {
"locked": {
"lastModified": 1656928814,
"narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

13
flake.nix Normal file
View file

@ -0,0 +1,13 @@
{
description = "jfdic-ops deployment";
inputs = {
nix.url = "github:NixOS/nix/?ref=2.10.3";
nixops.url = github:NixOS/nixops/?ref=master;
nixpkgs.url = github:NixOS/nixpkgs/?ref=nixos-22.05;
nixpkgsUnstable.url = github:NixOS/nixpkgs/?ref=nixos-unstable;
utils.url = "github:numtide/flake-utils";
};
outputs = {...} @ args: import ./outputs.nix args;
}

2
modules/modules-list.nix Normal file
View file

@ -0,0 +1,2 @@
[
]

37
nixos/configurations.nix Normal file
View file

@ -0,0 +1,37 @@
{
self,
nixpkgs,
inputs,
nix,
...
}: let
nixosSystem = nixpkgs.lib.makeOverridable nixpkgs.lib.nixosSystem;
customModules = import ../modules/modules-list.nix;
baseModules = [
# make flake inputs accessiable in NixOS
{_module.args.inputs = inputs;}
{
imports = [
({pkgs, ...}: {
nix.nixPath = [
"nixpkgs=${pkgs.path}"
];
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
documentation.info.enable = false;
})
];
}
];
defaultModules = baseModules ++ customModules;
in {
dionach = nixosSystem {
system = "x86_64-linux";
modules =
defaultModules
++ [
#./hosts/toscano/configuration.nix
];
};
}

27
outputs.nix Normal file
View file

@ -0,0 +1,27 @@
{
self,
nix,
nixops,
nixpkgs,
nixpkgsUnstable,
utils,
...
} @ inputs:
(utils.lib.eachDefaultSystem (system: let
pkgs =
nixpkgs.legacyPackages."${system}";
in {
devShell =
pkgs.callPackage
./shell.nix {
inherit (nix.packages."${pkgs.system}") nix;
inherit (nixpkgsUnstable.legacyPackages."${pkgs.system}") alejandra;
nixops = nixops.defaultPackage."${pkgs.system}";
};
}))
// {
nixosConfigurations = import ./nixos/configurations.nix (inputs
// {
inherit inputs;
});
}

16
shell.nix Normal file
View file

@ -0,0 +1,16 @@
{
pkgs ? import <nixpkgs> {},
alejandra,
mkShell,
nixops,
nix,
}:
with pkgs;
mkShell {
buildInputs = [
alejandra # The Uncompromising Nix Code Formatter
nixops
nix
treefmt # one CLI to format the code tree
];
}