commit 41d73744cac2d58fc457895056d61c46d557363c Author: xenia Date: Tue Aug 8 16:30:43 2023 +0200 Set up nix flake with container and dev shell diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..0ccf419 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1691421349, + "narHash": "sha256-RRJyX0CUrs4uW4gMhd/X4rcDG8PTgaaCQM5rXEJOx6g=", + "owner": "NixOs", + "repo": "nixpkgs", + "rev": "011567f35433879aae5024fc6ec53f2a0568a6c4", + "type": "github" + }, + "original": { + "owner": "NixOs", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..73ca80f --- /dev/null +++ b/flake.nix @@ -0,0 +1,34 @@ +{ + description = "Matabas — databas för mat"; + + inputs = { + nixpkgs.url = "github:NixOs/nixpkgs/nixos-23.05"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, flake-utils, nixpkgs }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in rec { + packages = rec { + hello = pkgs.hello; + default = hello; + }; + devShells.default = pkgs.mkShell { + packages = [ packages.default ]; + }; + } + ) // { + nixosConfigurations.matabas-container = + let pkgs = nixpkgs.legacyPackages.x86_64-linux; + in nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [({ pkgs, ... }: { + boot.isContainer = true; + system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev; + system.stateVersion = "23.05"; + environment.systemPackages = [ self.packages.x86_64-linux.default ]; + })]; + }; + }; +}