generated from stubbfel/nix-project-template
update to 24.05
This commit is contained in:
@@ -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"
|
||||
}
|
||||
9
.vscode/settings.json
vendored
9
.vscode/settings.json
vendored
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"terminal.integrated.profiles.linux": {
|
||||
"dev-shell": {
|
||||
"path": "bash",
|
||||
"args": [ "-c", "nix --experimental-features \"nix-command flakes\" develop"],
|
||||
"overrideName": true
|
||||
}
|
||||
}
|
||||
}
|
||||
9
LICENSE
9
LICENSE
@@ -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.
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
# 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
|
||||
|
||||
4
alias.sh
4
alias.sh
@@ -1,4 +0,0 @@
|
||||
#!/bin/env sh
|
||||
|
||||
alias nixe='nix --experimental-features "nix-command flakes"'
|
||||
alias ulock='nixe run .#devTasks.updateFlakeLock'
|
||||
61
flake.lock
generated
61
flake.lock
generated
@@ -1,61 +1,58 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-parts": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1704152458,
|
||||
"narHash": "sha256-DS+dGw7SKygIWf9w4eNBUZsK+4Ug27NwEWmn2tnbycg=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "88a2cd8166694ba0b6cb374700799cec53aef527",
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1704732714,
|
||||
"narHash": "sha256-ABqK/HggMYA/jMUXgYyqVAcQ8QjeMyr1jcXfTpSHmps=",
|
||||
"lastModified": 1719426051,
|
||||
"narHash": "sha256-yJL9VYQhaRM7xs0M867ZFxwaONB9T2Q4LnGo1WovuR4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "6723fa4e4f1a30d42a633bef5eb01caeb281adc3",
|
||||
"rev": "89c49874fb15f4124bf71ca5f42a04f2ee5825fd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-23.11",
|
||||
"ref": "nixos-24.05",
|
||||
"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",
|
||||
"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",
|
||||
|
||||
57
flake.nix
57
flake.nix
@@ -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, ... }:
|
||||
outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
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
|
||||
'';
|
||||
|
||||
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}";
|
||||
in
|
||||
{
|
||||
packages = rec {
|
||||
playground = space.playground.package;
|
||||
default = playground;
|
||||
};
|
||||
apps = rec {
|
||||
playground = flake-utils.lib.mkApp { drv = space.playground.package; exePath = ""; };
|
||||
default = playground;
|
||||
};
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
name = "dev-shell";
|
||||
packages = [ pkgs.nixfmt ];
|
||||
shellHook = ''
|
||||
. ./alias.sh
|
||||
'';
|
||||
};
|
||||
|
||||
checks = {
|
||||
package = space.playground.package;
|
||||
};
|
||||
};
|
||||
packages = [ pkgs.nixpkgs-fmt pkgs.nixpkgs-lint ];
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@ let
|
||||
|
||||
app = import ./services { config = config; };
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
package = app;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
{ config ? import ../config { } }:
|
||||
|
||||
config.nixpkgs.writeScript "example-web-server" ''
|
||||
${config.playground.server {config = config;}}
|
||||
''
|
||||
config.playground.server { config = config; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user