update to 24.05

This commit is contained in:
2024-06-29 14:37:35 +00:00
parent 289d35a051
commit c743f49838
12 changed files with 104 additions and 164 deletions

View File

@@ -1,31 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/alpine
{ {
"name": "Alpine", "name": "Alpine",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:alpine", "image": "mcr.microsoft.com/devcontainers/base:alpine",
"features": { "postCreateCommand": "sudo apk add nix nix-dev nix-doc nix-manual nix-bash-completion && sudo chown -R vscode:vscode /nix && echo 'experimental-features = nix-command flakes' | sudo tee -a /etc/nix/nix.conf",
"ghcr.io/devcontainers/features/nix:1": {} "runArgs": [
}, "--userns=keep-id"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "nix-env -i nixpkgs-fmt",
// Configure tool-specific properties.
"runArgs": ["--userns=keep-id"],
"containerUser": "vscode", "containerUser": "vscode",
"customizations": { "customizations": {
// Configure properties specific to VS Code.
"vscode": { "vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"settings": {
"terminal.integrated.defaultProfile.linux": "dev-shell"
}
},
"extensions": [ "extensions": [
"jnoortheen.nix-ide", "jnoortheen.nix-ide",
"ms-azuretools.vscode-docker", "ms-azuretools.vscode-docker",
@@ -36,7 +18,4 @@
] ]
} }
} }
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}

View File

@@ -1,9 +0,0 @@
{
"terminal.integrated.profiles.linux": {
"dev-shell": {
"path": "bash",
"args": [ "-c", "nix --experimental-features \"nix-command flakes\" develop"],
"overrideName": true
}
}
}

View File

@@ -1,8 +1,13 @@
MIT License MIT License
Copyright (c) 2022 stubbfel Copyright
(c) 2022
stubbfel
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: Permission
is
hereby
granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

View File

@@ -3,10 +3,11 @@
## Nix Flake commands ## Nix Flake commands
```sh ```sh
# nix flake are experimental and required following options --experimental-features 'nix-command flakes' # nix flake are experimental and required following options --experimental-features 'nix-command flakes'
# create alias for nix --experimental-features 'nix-command flakes' # create alias for nix --experimental-features 'nix-command flakes'
alias nixe && echo Alias for nixe exists || alias nixe="nix --experimental-features 'nix-command flakes'" alias
nixe && echo Alias for nixe exists || alias nixe="nix --experimental-features 'nix-command flakes'"
# build # build
nixe build nixe build
@@ -23,4 +24,4 @@ nixe run .#devTasks.updateFlakeLock
# tag project # tag project
nixe run .#devTasks.autoTag nixe run .#devTasks.autoTag
``` ```

View File

@@ -1,4 +0,0 @@
#!/bin/env sh
alias nixe='nix --experimental-features "nix-command flakes"'
alias ulock='nixe run .#devTasks.updateFlakeLock'

View File

@@ -2,5 +2,5 @@
{ {
nixpkgs = nixpkgs; nixpkgs = nixpkgs;
playground = { port = "8083"; server = import ../playground/example/services/rust; }; playground = { port = "8083"; server = import ../playground/example/services/rust; };
} }

113
flake.lock generated
View File

@@ -1,63 +1,60 @@
{ {
"nodes": { "nodes": {
"flake-parts": { "flake-utils": {
"inputs": { "inputs": {
"nixpkgs-lib": "nixpkgs-lib" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1704152458, "lastModified": 1710146030,
"narHash": "sha256-DS+dGw7SKygIWf9w4eNBUZsK+4Ug27NwEWmn2tnbycg=", "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "hercules-ci", "owner": "numtide",
"repo": "flake-parts", "repo": "flake-utils",
"rev": "88a2cd8166694ba0b6cb374700799cec53aef527", "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "hercules-ci", "owner": "numtide",
"repo": "flake-parts", "repo": "flake-utils",
"type": "github" "type": "github"
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1704732714, "lastModified": 1719426051,
"narHash": "sha256-ABqK/HggMYA/jMUXgYyqVAcQ8QjeMyr1jcXfTpSHmps=", "narHash": "sha256-yJL9VYQhaRM7xs0M867ZFxwaONB9T2Q4LnGo1WovuR4=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "6723fa4e4f1a30d42a633bef5eb01caeb281adc3", "rev": "89c49874fb15f4124bf71ca5f42a04f2ee5825fd",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "id": "nixpkgs",
"ref": "nixos-23.11", "ref": "nixos-24.05",
"type": "indirect" "type": "indirect"
} }
}, },
"nixpkgs-lib": { "root": {
"locked": { "inputs": {
"dir": "lib", "flake-utils": "flake-utils",
"lastModified": 1703961334, "nixpkgs": "nixpkgs"
"narHash": "sha256-M1mV/Cq+pgjk0rt6VxoyyD+O8cOUiai8t9Q6Yyq4noY=", }
"owner": "NixOS", },
"repo": "nixpkgs", "systems": {
"rev": "b0d36bd0a420ecee3bc916c91886caca87c894e9", "locked": {
"type": "github" "lastModified": 1681028828,
}, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"original": { "owner": "nix-systems",
"dir": "lib", "repo": "default",
"owner": "NixOS", "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"ref": "nixos-unstable", "type": "github"
"repo": "nixpkgs", },
"type": "github" "original": {
} "owner": "nix-systems",
}, "repo": "default",
"root": { "type": "github"
"inputs": { }
"flake-parts": "flake-parts", }
"nixpkgs": "nixpkgs"
}
}
}, },
"root": "root", "root": "root",
"version": 7 "version": 7
} }

View File

@@ -1,62 +1,33 @@
{ {
description = ""; description = "";
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11"; nixpkgs.url = "nixpkgs/nixos-24.05";
flake-parts.url = "github:hercules-ci/flake-parts"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = inputs: outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system:
inputs.flake-parts.lib.mkFlake { inherit inputs; } { let
systems = [ "x86_64-linux" "aarch64-linux" ]; pkgs = nixpkgs.legacyPackages.${system};
perSystem = { config, pkgs, system, ... }: version = "0.0.1";
let name = "develnixos";
version = "0.0.1"; space = rec {
name = "develnixos"; config = import ./config { nixpkgs = pkgs; };
playground = import ./playground/example { config = space.config; };
};
updateLockScript = pkgs.writeShellScriptBin "update_flake_lock.sh" '' in
nix --experimental-features 'nix-command flakes' flake lock --update-input nixpkgs {
nix --experimental-features 'nix-command flakes' build packages = rec {
''; playground = space.playground.package;
default = playground;
};
apps = rec {
playground = flake-utils.lib.mkApp { drv = space.playground.package; exePath = ""; };
default = playground;
};
autoTag = pkgs.writeScript "auto_tag.sh" '' devShells.default = pkgs.mkShell {
git tag --force v${version} packages = [ pkgs.nixpkgs-fmt pkgs.nixpkgs-lint ];
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
'';
in {
packages.default = space.playground.package;
apps = {
default = space.playground.app;
updateFlakeLock = {
type = "app";
program = "${updateLockScript}/bin/update_flake_lock.sh";
};
autoTag = {
type = "app";
program = "${autoTag}";
};
};
devShells.default = pkgs.mkShell {
name = "dev-shell";
packages = [ pkgs.nixfmt ];
shellHook = ''
. ./alias.sh
'';
};
checks = {
package = space.playground.package;
};
};
};
} }

View File

@@ -1,5 +1,5 @@
{ config ? import ../../../config { } }: { config ? import ../../../config { } }:
{ {
playground = { port = "8081"; server = import ../services/python; }; playground = { port = "8081"; server = import ../services/python; };
} // config } // config

View File

@@ -4,7 +4,8 @@ let
app = import ./services { config = config; }; app = import ./services { config = config; };
in { in
{
package = app; package = app;

View File

@@ -1,5 +1,4 @@
{ config ? import ../config { } }: { config ? import ../config { } }:
config.nixpkgs.writeScript "example-web-server" '' config.playground.server { config = config; }
${config.playground.server {config = config;}}
''

View File

@@ -2,4 +2,4 @@
config.nixpkgs.writeScript "python-example-web-server" '' config.nixpkgs.writeScript "python-example-web-server" ''
${config.nixpkgs.python3}/bin/python -m http.server ${config.playground.port} ${config.nixpkgs.python3}/bin/python -m http.server ${config.playground.port}
'' ''