diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 511352a..47b2221 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -15,6 +15,8 @@ // "postCreateCommand": "nix-env -i nixpkgs-fmt", // Configure tool-specific properties. + "runArgs": ["--userns=keep-id"], + "containerUser": "vscode", "customizations": { // Configure properties specific to VS Code. "vscode": { diff --git a/flake.lock b/flake.lock index 7fa99d6..6d2c2e6 100644 --- a/flake.lock +++ b/flake.lock @@ -1,22 +1,59 @@ { "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1704152458, + "narHash": "sha256-DS+dGw7SKygIWf9w4eNBUZsK+4Ug27NwEWmn2tnbycg=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "88a2cd8166694ba0b6cb374700799cec53aef527", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1686331006, - "narHash": "sha256-hElRDWUNG655aqF0awu+h5cmDN+I/dQcChRt2tGuGGU=", + "lastModified": 1704732714, + "narHash": "sha256-ABqK/HggMYA/jMUXgYyqVAcQ8QjeMyr1jcXfTpSHmps=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "85bcb95aa83be667e562e781e9d186c57a07d757", + "rev": "6723fa4e4f1a30d42a633bef5eb01caeb281adc3", "type": "github" }, "original": { "id": "nixpkgs", - "ref": "nixos-23.05", + "ref": "nixos-23.11", "type": "indirect" } }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1703961334, + "narHash": "sha256-M1mV/Cq+pgjk0rt6VxoyyD+O8cOUiai8t9Q6Yyq4noY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b0d36bd0a420ecee3bc916c91886caca87c894e9", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { + "flake-parts": "flake-parts", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index b96f7af..fa6a8c4 100644 --- a/flake.nix +++ b/flake.nix @@ -1,67 +1,62 @@ { description = ""; - inputs = { - nixpkgs.url = "nixpkgs/nixos-23.05"; + inputs = { + nixpkgs.url = "nixpkgs/nixos-23.11"; + flake-parts.url = "github:hercules-ci/flake-parts"; }; - outputs = { self, nixpkgs }: - let - version = "0.0.1"; - name = "develnixos"; - - supportedSystems = [ "x86_64-linux" "aarch64-linux" ]; - forAllSystems = nixpkgs.lib.genAttrs supportedSystems; - nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); - - devTaskScripts = forAllSystems (system: { - autoTag = nixpkgsFor.${system}.writeScript "auto_tag.sh" '' - git tag --force v${version} - git push origin v${version} - ''; - }); - - space = forAllSystems (system: rec { - config = import ./config { nixpkgs = nixpkgsFor.${system}; }; - playground = import ./playground/example { config = config; }; - }); - - in rec { - packages = forAllSystems (system: { - default = space.${system}.playground.package; - }); - apps = forAllSystems (system: + outputs = inputs: + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "x86_64-linux" "aarch64-linux" ]; + perSystem = { config, pkgs, system, ... }: let - testConfig = import ./config { nixpkgs = nixpkgsFor.${system}; }; - testapp = import ./playground/example { config = testConfig; }; + version = "0.0.1"; + name = "develnixos"; + + updateLockScript = pkgs.writeShellScriptBin "update_flake_lock.sh" '' + nix --experimental-features 'nix-command flakes' flake lock --update-input nixpkgs + nix --experimental-features 'nix-command flakes' build + ''; + + autoTag = pkgs.writeScript "auto_tag.sh" '' + git tag --force v${version} + git push origin v${version} + ''; + + space = rec { + config = import ./config { nixpkgs = pkgs; }; + playground = import ./playground/example { config = space.config; }; + }; + + foo = pkgs.runCommand "linter" '' + echo the_linter + ''; - updateLockScript = - nixpkgsFor.${system}.writeShellScriptBin "update_flake_lock.sh" '' - nix --experimental-features 'nix-command flakes' flake lock --update-input nixpkgs - nix --experimental-features 'nix-command flakes' build - ''; in { - default = space.${system}.playground.app; - devTasks = { + packages.default = space.playground.package; + apps = { + default = space.playground.app; updateFlakeLock = { - type = "app"; - program = "${updateLockScript}/bin/update_flake_lock.sh"; + type = "app"; + program = "${updateLockScript}/bin/update_flake_lock.sh"; }; autoTag = { - type = "app"; - program = "${devTaskScripts.${system}.autoTag}"; + type = "app"; + program = "${autoTag}"; }; }; - }); - devShells = forAllSystems (system: { - default = nixpkgsFor.${system}.mkShell { - name = "dev-shell"; - packages = [ nixpkgsFor.${system}.nixfmt ]; - shellHook = '' - . ./alias.sh - ''; + devShells.default = pkgs.mkShell { + name = "dev-shell"; + packages = [ pkgs.nixfmt ]; + shellHook = '' + . ./alias.sh + ''; + }; + + checks = { + package = space.playground.package; + }; }; - }); - }; }