This commit is contained in:
2024-01-10 21:21:58 +00:00
parent 23173d0875
commit 289d35a051
3 changed files with 89 additions and 55 deletions

View File

@@ -15,6 +15,8 @@
// "postCreateCommand": "nix-env -i nixpkgs-fmt", // "postCreateCommand": "nix-env -i nixpkgs-fmt",
// Configure tool-specific properties. // Configure tool-specific properties.
"runArgs": ["--userns=keep-id"],
"containerUser": "vscode",
"customizations": { "customizations": {
// Configure properties specific to VS Code. // Configure properties specific to VS Code.
"vscode": { "vscode": {

45
flake.lock generated
View File

@@ -1,22 +1,59 @@
{ {
"nodes": { "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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1686331006, "lastModified": 1704732714,
"narHash": "sha256-hElRDWUNG655aqF0awu+h5cmDN+I/dQcChRt2tGuGGU=", "narHash": "sha256-ABqK/HggMYA/jMUXgYyqVAcQ8QjeMyr1jcXfTpSHmps=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "85bcb95aa83be667e562e781e9d186c57a07d757", "rev": "6723fa4e4f1a30d42a633bef5eb01caeb281adc3",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "id": "nixpkgs",
"ref": "nixos-23.05", "ref": "nixos-23.11",
"type": "indirect" "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": { "root": {
"inputs": { "inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
} }

View File

@@ -1,67 +1,62 @@
{ {
description = ""; description = "";
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixos-23.05"; nixpkgs.url = "nixpkgs/nixos-23.11";
flake-parts.url = "github:hercules-ci/flake-parts";
}; };
outputs = { self, nixpkgs }: outputs = inputs:
let inputs.flake-parts.lib.mkFlake { inherit inputs; } {
version = "0.0.1"; systems = [ "x86_64-linux" "aarch64-linux" ];
name = "develnixos"; perSystem = { config, pkgs, system, ... }:
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:
let let
testConfig = import ./config { nixpkgs = nixpkgsFor.${system}; }; version = "0.0.1";
testapp = import ./playground/example { config = testConfig; }; 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 { in {
default = space.${system}.playground.app; packages.default = space.playground.package;
devTasks = { apps = {
default = space.playground.app;
updateFlakeLock = { updateFlakeLock = {
type = "app"; type = "app";
program = "${updateLockScript}/bin/update_flake_lock.sh"; program = "${updateLockScript}/bin/update_flake_lock.sh";
}; };
autoTag = { autoTag = {
type = "app"; type = "app";
program = "${devTaskScripts.${system}.autoTag}"; program = "${autoTag}";
}; };
}; };
});
devShells = forAllSystems (system: { devShells.default = pkgs.mkShell {
default = nixpkgsFor.${system}.mkShell { name = "dev-shell";
name = "dev-shell"; packages = [ pkgs.nixfmt ];
packages = [ nixpkgsFor.${system}.nixfmt ]; shellHook = ''
shellHook = '' . ./alias.sh
. ./alias.sh '';
''; };
checks = {
package = space.playground.package;
};
}; };
});
}; };
} }