Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.
For the best experience please use the latest Chrome, Safari or Firefox browser.
Nix | Javascript |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nix eval --exp '(x: y: { a = x + "-" + y; }) "Datenspuren" "2022"'
❯ nix repl
Welcome to Nix 2.9.1. Type :? for help.
nix-repl> (x: y: { a = x + "-" + y; }) "Datenspuren" "2022"
{ a = "Datenspuren-2022"; }
with import <nixpkgs> {}; stdenv.mkDerivation {
name = "hello";
src = ./src;
buildInputs = [ coreutils gcc ];
configurePhase = ''
declare -xp
'';
buildPhase = ''
gcc "$src/hello.c" -o ./hello
'';
installPhase = ''
mkdir -p "$out/bin"
cp ./hello "$out/bin/"
'';
}
default.nix
with import <nixpkgs> {};
runCommand "name" {envVariable = true;} ''echo hello > $out''
default.nix
/nix/store/$(cryptographic-hash)-$(package-name)-$(version)/$(package-contents)
❯ ls /nix/store/*hello*
/nix/store/g4dl2djh719933klf04bmmrjdswfpzip-hello-2.10.tar.gz.drv
/nix/store/qpskxiffl94sy3awnwprra2id9r911zr-hello-2.10.drv
/nix/store/dd617z4bscvvv6i0d9d1x2ml96pi04nk-hello-2.10:
bin share
Organisationsstruktur für Betriebssystem-komponenten und Dienste mit Konfigurationsoptionen
oder
man configuration.nix
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.uptimed;
stateDir = "/var/lib/uptimed";
in
{
options = {
services.uptimed = {
enable = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc ''
Enable `uptimed`, allowing you to track
your highest uptimes.
'';
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.uptimed ];
users.users.uptimed = {
description = "Uptimed daemon user";
home = stateDir;
uid = config.ids.uids.uptimed;
group = "uptimed";
};
users.groups.uptimed = {};
systemd.services.uptimed = {
description = "uptimed service";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Restart = "on-failure";
User = "uptimed";
StateDirectory = [ "uptimed" ];
ExecStart = "${pkgs.uptimed}/sbin/uptimed -f -p ${stateDir}/pid";
};
};
};
}
{
outputs = { self }: {
foo = "Datenspuren";
};
}
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
};
outputs = { self, nixpkgs }: {
packages.x86_64-linux.hello = nixpkgs.legacyPackages.x86_64-linux.hello;
};
}