krebs os-release: init
This commit is contained in:
parent
89f731a898
commit
54129c440e
11
Makefile
11
Makefile
@ -1,5 +1,12 @@
|
|||||||
stockholm ?= .
|
stockholm ?= .
|
||||||
|
|
||||||
|
export STOCKHOLM_VERSION ?= $(shell \
|
||||||
|
version=git.$$(git describe --always --dirty); \
|
||||||
|
case $$version in (*-dirty) version=$$version@$$(hostname); esac; \
|
||||||
|
date=$$(date +%y.%m); \
|
||||||
|
printf '%s' "$$date.$$version"; \
|
||||||
|
)
|
||||||
|
|
||||||
ifndef nixos-config
|
ifndef nixos-config
|
||||||
$(if $(system),,$(error unbound variable: system))
|
$(if $(system),,$(error unbound variable: system))
|
||||||
nixos-config = ./$(LOGNAME)/1systems/$(system).nix
|
nixos-config = ./$(LOGNAME)/1systems/$(system).nix
|
||||||
@ -60,7 +67,8 @@ deploy: ssh ?= ssh
|
|||||||
deploy:
|
deploy:
|
||||||
$(call execute,populate)
|
$(call execute,populate)
|
||||||
$(ssh) $(target_user)@$(target_host) -p $(target_port) \
|
$(ssh) $(target_user)@$(target_host) -p $(target_port) \
|
||||||
nixos-rebuild switch --show-trace -I $(target_path)
|
env STOCKHOLM_VERSION="$$STOCKHOLM_VERSION" \
|
||||||
|
nixos-rebuild switch --show-trace -I $(target_path)
|
||||||
|
|
||||||
# usage: make LOGNAME=shared system=wolf eval.config.krebs.build.host.name
|
# usage: make LOGNAME=shared system=wolf eval.config.krebs.build.host.name
|
||||||
eval eval.:;@$(call evaluate,$${expr-eval})
|
eval eval.:;@$(call evaluate,$${expr-eval})
|
||||||
@ -75,6 +83,7 @@ install:
|
|||||||
target_path=/mnt$(target_path) $(call execute,populate)
|
target_path=/mnt$(target_path) $(call execute,populate)
|
||||||
$(ssh) $(target_user)@$(target_host) -p $(target_port) \
|
$(ssh) $(target_user)@$(target_host) -p $(target_port) \
|
||||||
env NIXOS_CONFIG=$(target_path)/nixos-config \
|
env NIXOS_CONFIG=$(target_path)/nixos-config \
|
||||||
|
STOCKHOLM_VERSION="$$STOCKHOLM_VERSION" \
|
||||||
nixos-install
|
nixos-install
|
||||||
|
|
||||||
# usage: make test system=foo [target=bar] [method={eval,build}]
|
# usage: make test system=foo [target=bar] [method={eval,build}]
|
||||||
|
@ -23,6 +23,7 @@ let
|
|||||||
./lib.nix
|
./lib.nix
|
||||||
./nginx.nix
|
./nginx.nix
|
||||||
./nixpkgs.nix
|
./nixpkgs.nix
|
||||||
|
./os-release.nix
|
||||||
./per-user.nix
|
./per-user.nix
|
||||||
./Reaktor.nix
|
./Reaktor.nix
|
||||||
./realwallpaper.nix
|
./realwallpaper.nix
|
||||||
|
28
krebs/3modules/os-release.nix
Normal file
28
krebs/3modules/os-release.nix
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{ config, ... }:
|
||||||
|
with config.krebs.lib;
|
||||||
|
let
|
||||||
|
nixos-version-id = "${config.system.nixosVersion}";
|
||||||
|
nixos-version = "${nixos-version-id} (${config.system.nixosCodeName})";
|
||||||
|
nixos-pretty-name = "NixOS ${nixos-version}";
|
||||||
|
|
||||||
|
stockholm-version-id = maybeEnv "STOCKHOLM_VERSION" "unknown";
|
||||||
|
stockholm-version = "${stockholm-version-id}";
|
||||||
|
stockholm-pretty-name = "stockholm ${stockholm-version}";
|
||||||
|
|
||||||
|
version = "${stockholm-version}/${nixos-version}";
|
||||||
|
version-id = "${stockholm-version-id}/${nixos-version-id}";
|
||||||
|
pretty-name = "${stockholm-pretty-name} / ${nixos-pretty-name}";
|
||||||
|
|
||||||
|
home-url = http://cgit.cd.krebsco.de/stockholm;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
# http://0pointer.de/public/systemd-man/os-release.html
|
||||||
|
environment.etc."os-release".text = mkForce ''
|
||||||
|
NAME="stockholm/NixOS"
|
||||||
|
ID=stockholm
|
||||||
|
VERSION="${version}"
|
||||||
|
VERSION_ID="${version-id}"
|
||||||
|
PRETTY_NAME="${pretty-name}"
|
||||||
|
HOME_URL="${home-url}"
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user