summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bragi.nix21
-rw-r--r--custom/redo-wrapper.nix4
m---------custom/trivmix0
-rw-r--r--customized/autofs.nix120
-rw-r--r--users/gkleen@bragi.nix8
5 files changed, 19 insertions, 134 deletions
diff --git a/bragi.nix b/bragi.nix
index 10f42e88..932d0cdf 100644
--- a/bragi.nix
+++ b/bragi.nix
@@ -7,7 +7,6 @@ in rec {
7 imports = 7 imports =
8 [ 8 [
9 ./bragi-hw.nix 9 ./bragi-hw.nix
10 ./customized/autofs.nix
11 ./custom/zsh.nix 10 ./custom/zsh.nix
12 ./users.nix 11 ./users.nix
13 ]; 12 ];
@@ -243,12 +242,18 @@ in rec {
243 home = "/var/lib/thermoprint"; 242 home = "/var/lib/thermoprint";
244 }; 243 };
245 244
246 systemd.services."thermoprint" = { 245 systemd.services."thermoprint" = {
247 serviceConfig = { 246 serviceConfig = {
248 Type = "simple"; 247 Type = "simple";
249 ExecStart = ''${thermoprint-servant}/bin/thermoprint --database ${users.extraUsers."thermoprint".home}/database.sqlite /dev/usb/lp0''; 248 ExecStart = ''${thermoprint-servant}/bin/thermoprint --database ${users.extraUsers."thermoprint".home}/database.sqlite /dev/usb/lp0'';
250 User = users.extraUsers."thermoprint".name; 249 User = users.extraUsers."thermoprint".name;
251 Group = users.extraUsers."thermoprint".group; 250 Group = users.extraUsers."thermoprint".group;
252 };
253 }; 251 };
252 };
253
254 nix = {
255 extraOptions = ''
256 binary-caches-parallel-connections = 10
257 '';
258 };
254} 259}
diff --git a/custom/redo-wrapper.nix b/custom/redo-wrapper.nix
index 5b446636..3a3d7bbc 100644
--- a/custom/redo-wrapper.nix
+++ b/custom/redo-wrapper.nix
@@ -1,8 +1,8 @@
1{ stdenv, makeWrapper, haskellngPackages }: 1{ stdenv, makeWrapper, haskellPackages }:
2 2
3let 3let
4 #redo = haskellPackages.callPackage ./redo.nix {}; 4 #redo = haskellPackages.callPackage ./redo.nix {};
5 redo = stdenv.lib.overrideDerivation (haskellngPackages.redo) (attrs: { 5 redo = stdenv.lib.overrideDerivation (haskellPackages.redo) (attrs: {
6 patches = attrs.patches ++ [./redo.patch]; 6 patches = attrs.patches ++ [./redo.patch];
7 }); 7 });
8in stdenv.mkDerivation { 8in stdenv.mkDerivation {
diff --git a/custom/trivmix b/custom/trivmix
Subproject d40917517feeaffc3d8e90cf8e06004623b0c5f Subproject 782b5b37976fce5e10b4e7df96bcc19c48fff0b
diff --git a/customized/autofs.nix b/customized/autofs.nix
deleted file mode 100644
index f4a1059d..00000000
--- a/customized/autofs.nix
+++ /dev/null
@@ -1,120 +0,0 @@
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7 cfg = config.services.autofs;
8
9 autoMaster = pkgs.writeText "auto.master" cfg.autoMaster;
10
11in
12
13{
14
15 ###### interface
16
17 options = {
18
19 services.autofs = {
20
21 enable = mkOption {
22 default = false;
23 description = "
24 Mount filesystems on demand. Unmount them automatically.
25 You may also be interested in afuese.
26 ";
27 };
28
29 autoMaster = mkOption {
30 example = literalExample ''
31 autoMaster = let
32 mapConf = pkgs.writeText "auto" '''
33 kernel -ro,soft,intr ftp.kernel.org:/pub/linux
34 boot -fstype=ext2 :/dev/hda1
35 windoze -fstype=smbfs ://windoze/c
36 removable -fstype=ext2 :/dev/hdd
37 cd -fstype=iso9660,ro :/dev/hdc
38 floppy -fstype=auto :/dev/fd0
39 server -rw,hard,intr / -ro myserver.me.org:/ \
40 /usr myserver.me.org:/usr \
41 /home myserver.me.org:/home
42 ''';
43 in '''
44 /auto file:''${mapConf}
45 '''
46 '';
47 description = "
48 file contents of /etc/auto.master. See man auto.master
49 See man 5 auto.master and man 5 autofs.
50 ";
51 };
52
53 timeout = mkOption {
54 default = 600;
55 description = "Set the global minimum timeout, in seconds, until directories are unmounted";
56 };
57
58 debug = mkOption {
59 default = false;
60 description = "
61 pass -d and -7 to automount and write log to /var/log/autofs
62 ";
63 };
64
65 };
66
67 };
68
69
70 ###### implementation
71
72 config = mkIf cfg.enable {
73
74 environment.etc = singleton
75 { target = "auto.master";
76 source = pkgs.writeText "auto.master" cfg.autoMaster;
77 };
78
79 boot.kernelModules = [ "autofs4" ];
80
81 jobs.autofs =
82 { description = "Filesystem automounter";
83
84 startOn = "started network-interfaces";
85 stopOn = "stopping network-interfaces";
86
87 path = [ pkgs.nfs-utils pkgs.sshfsFuse ];
88
89 preStop =
90 ''
91 set -e; while :; do pkill -TERM automount; sleep 1; done
92 '';
93
94 # automount doesn't clean up when receiving SIGKILL.
95 # umount -l should unmount the directories recursively when they are no longer used
96 # It does, but traces are left in /etc/mtab. So unmount recursively..
97 postStop =
98 ''
99 PATH=${pkgs.gnused}/bin:${pkgs.coreutils}/bin
100 exec &> /tmp/logss
101 # double quote for sed:
102 escapeSpaces(){ sed 's/ /\\\\040/g'; }
103 unescapeSpaces(){ sed 's/\\040/ /g'; }
104 sed -n 's@^\s*\(\([^\\ ]\|\\ \)*\)\s.*@\1@p' ${autoMaster} | sed 's/[\\]//' | while read mountPoint; do
105 sed -n "s@[^ ]\+\s\+\($(echo "$mountPoint"| escapeSpaces)[^ ]*\).*@\1@p" /proc/mounts | sort -r | unescapeSpaces| while read smountP; do
106 ${pkgs.utillinux}/bin/umount -l "$smountP" || true
107 done
108 done
109 '';
110
111 script =
112 ''
113 ${if cfg.debug then "exec &> /var/log/autofs" else ""}
114 exec ${pkgs.autofs5}/sbin/automount ${if cfg.debug then "-d" else ""} -f -t ${builtins.toString cfg.timeout} "${autoMaster}" ${if cfg.debug then "-l7" else ""}
115 '';
116 };
117
118 };
119
120}
diff --git a/users/gkleen@bragi.nix b/users/gkleen@bragi.nix
index b67696a5..a32fa0d1 100644
--- a/users/gkleen@bragi.nix
+++ b/users/gkleen@bragi.nix
@@ -30,12 +30,12 @@
30 }; 30 };
31 myHaskellPackages = pkgs.recurseIntoAttrs ( 31 myHaskellPackages = pkgs.recurseIntoAttrs (
32 pkgs.haskellPackages.override { 32 pkgs.haskellPackages.override {
33 extension = self: super: let 33 overrides = self: super: let
34 callPackage = pkgs.lib.callPackageWith ( pkgs // self ); 34 callPackage = pkgs.lib.callPackageWith ( pkgs // self );
35 in { 35 in {
36 attoparsecExpr = callPackage ../custom/attoparsec-expr.nix {}; 36 # attoparsecExpr = callPackage ../custom/attoparsec-expr.nix {};
37 shellMonad = callPackage ../custom/shell-monad.nix {}; 37 # shellMonad = callPackage ../custom/shell-monad.nix {};
38 filelock = callPackage ../custom/filelock.nix {}; 38 # filelock = callPackage ../custom/filelock.nix {};
39 trivmix = callPackage ../custom/trivmix.nix {}; 39 trivmix = callPackage ../custom/trivmix.nix {};
40 }; 40 };
41 } 41 }