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",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:alpine",
"features": {
"ghcr.io/devcontainers/features/nix:1": {}
},
// 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"],
"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",
"runArgs": [
"--userns=keep-id"
],
"containerUser": "vscode",
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"settings": {
"terminal.integrated.defaultProfile.linux": "dev-shell"
}
},
"extensions": [
"jnoortheen.nix-ide",
"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
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.

View File

@@ -3,10 +3,11 @@
## Nix Flake commands
```sh
# nix flake are experimental and required following options --experimental-features 'nix-command flakes'
# create alias for nix --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'
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
nixe build
@@ -23,4 +24,4 @@ nixe run .#devTasks.updateFlakeLock
# tag project
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;
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": {
"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": 1704732714,
"narHash": "sha256-ABqK/HggMYA/jMUXgYyqVAcQ8QjeMyr1jcXfTpSHmps=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6723fa4e4f1a30d42a633bef5eb01caeb281adc3",
"type": "github"
},
"original": {
"id": "nixpkgs",
"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"
}
}
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1719426051,
"narHash": "sha256-yJL9VYQhaRM7xs0M867ZFxwaONB9T2Q4LnGo1WovuR4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "89c49874fb15f4124bf71ca5f42a04f2ee5825fd",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-24.05",
"type": "indirect"
}
},
"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
}
}

View File

@@ -1,62 +1,33 @@
{
description = "";
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11";
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "nixpkgs/nixos-24.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" ];
perSystem = { config, pkgs, system, ... }:
let
version = "0.0.1";
name = "develnixos";
outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
version = "0.0.1";
name = "develnixos";
space = rec {
config = import ./config { nixpkgs = pkgs; };
playground = import ./playground/example { config = space.config; };
};
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
'';
in
{
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" ''
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
'';
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;
};
};
};
devShells.default = pkgs.mkShell {
packages = [ pkgs.nixpkgs-fmt pkgs.nixpkgs-lint ];
};
});
}

View File

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

View File

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

View File

@@ -1,5 +1,4 @@
{ 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.python3}/bin/python -m http.server ${config.playground.port}
''
''