diff options
author | jeschli <jeschli@gmail.com> | 2018-12-04 19:27:27 +0100 |
---|---|---|
committer | jeschli <jeschli@gmail.com> | 2018-12-04 19:27:27 +0100 |
commit | 5030b74cc5c578bb82619a24592504a6008f1a10 (patch) | |
tree | 0551e3ddb94353b7438bec02174bf3379bc89b87 /tv/2configs | |
parent | 78b289201987675844aa37abeb4279eb4051ebe0 (diff) | |
parent | 82988de84c177c247ebbe80940c4d50b9f073b4e (diff) |
Merge branch 'master' of prism.r:stockholm
Diffstat (limited to 'tv/2configs')
-rw-r--r-- | tv/2configs/bash/default.nix | 22 | ||||
-rw-r--r-- | tv/2configs/default.nix | 5 | ||||
-rw-r--r-- | tv/2configs/gitrepos.nix | 1 | ||||
-rw-r--r-- | tv/2configs/pulse.nix | 2 | ||||
-rw-r--r-- | tv/2configs/urlwatch.nix | 5 | ||||
-rw-r--r-- | tv/2configs/vim.nix | 83 | ||||
-rw-r--r-- | tv/2configs/xp-332.nix | 4 | ||||
-rw-r--r-- | tv/2configs/xserver/Xresources.nix | 5 | ||||
-rw-r--r-- | tv/2configs/xserver/default.nix | 37 |
9 files changed, 119 insertions, 45 deletions
diff --git a/tv/2configs/bash/default.nix b/tv/2configs/bash/default.nix index b75ad8bfc..d7673931c 100644 --- a/tv/2configs/bash/default.nix +++ b/tv/2configs/bash/default.nix @@ -13,6 +13,20 @@ with import <stockholm/lib>; shopt -s histappend histreedit histverify shopt -s no_empty_cmd_completion complete -d cd + + case $UID in + ${shell.escape (toString config.krebs.users.tv.uid)}) + if test ''${SHLVL-1} = 1; then + case ''${XMONAD_SPAWN_WORKSPACE-} in + stockholm) + cd ~/stockholm + ;; + esac + fi + + export NIX_PATH="stockholm=$HOME/stockholm:$NIX_PATH" + ;; + esac ''; promptInit = /* sh */ '' case $UID in @@ -32,14 +46,6 @@ with import <stockholm/lib>; if test -n "$SSH_AGENT_PID"; then PS1="ssh-agent[$SSH_AGENT_PID] $PS1" fi - - if test ''${SHLVL-1} = 1; then - case ''${XMONAD_SPAWN_WORKSPACE-} in - stockholm) - cd ~/stockholm - ;; - esac - fi ''; }; } diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix index d9ddc90d0..484a337b7 100644 --- a/tv/2configs/default.nix +++ b/tv/2configs/default.nix @@ -87,11 +87,6 @@ with import <stockholm/lib>; export SYSTEM="$1" exec nix-shell -I stockholm="$PWD" --run 'deploy --system="$SYSTEM"' ''; - reload = "systemctl reload"; - restart = "systemctl restart"; - start = "systemctl start"; - status = "systemctl status"; - stop = "systemctl stop"; }; environment.variables = { diff --git a/tv/2configs/gitrepos.nix b/tv/2configs/gitrepos.nix index 62c90d4e9..a89d1302c 100644 --- a/tv/2configs/gitrepos.nix +++ b/tv/2configs/gitrepos.nix @@ -76,6 +76,7 @@ let { }; } // mapAttrs (_: recursiveUpdate { cgit.section = "3. Haskell libraries"; }) { blessings = {}; + hc = {}; mime = {}; quipper = {}; scanner = {}; diff --git a/tv/2configs/pulse.nix b/tv/2configs/pulse.nix index c051b4261..2e679bd14 100644 --- a/tv/2configs/pulse.nix +++ b/tv/2configs/pulse.nix @@ -95,7 +95,7 @@ in users = { groups.pulse.gid = config.users.users.pulse.uid; users.pulse = { - uid = genid "pulse"; + uid = genid_uint31 "pulse"; group = "pulse"; extraGroups = [ "audio" ]; home = "${runDir}/home"; diff --git a/tv/2configs/urlwatch.nix b/tv/2configs/urlwatch.nix index 77947dafa..7467e8e67 100644 --- a/tv/2configs/urlwatch.nix +++ b/tv/2configs/urlwatch.nix @@ -27,11 +27,6 @@ in { # 2014-09-24 ref https://github.com/4z3/xintmap http://www.mathstat.dal.ca/~selinger/quipper/ - ## other - - https://nixos.org/channels/nixos-18.03/git-revision - https://nixos.org/channels/nixos-unstable/git-revision - ## 2014-10-17 ## TODO update ~/src/login/default.nix #http://hackage.haskell.org/package/bcrypt diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 2ac7f7518..3794628c1 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -14,8 +14,25 @@ let { }; extra-runtimepath = concatMapStringsSep "," (pkg: "${pkg.rtp}") [ + # cannot use pkgs.vimPlugins.fzf-vim as it's missing :Rg + (pkgs.vimUtils.buildVimPlugin { + name = "fzf-2018-11-14"; + src = pkgs.fetchgit { + url = https://github.com/junegunn/fzf.vim; + rev = "ad1833ecbc9153b6e34a4292dc089a58c4bcb8dc"; + sha256 = "1z2q71q6l9hq9fqfqpj1svhyk4yk1bzw1ljhksx4bnpz8gkfbx2m"; + }; + }) + pkgs.vimPlugins.fzfWrapper pkgs.vimPlugins.undotree - pkgs.vimPlugins.vim-elixir + (pkgs.vimUtils.buildVimPlugin { + name = "vim-elixir-2018-08-17"; + src = pkgs.fetchgit { + url = https://github.com/elixir-editors/vim-elixir; + rev = "0a847f0faed5ba2d94bb3d51f355c50f37ba025b"; + sha256 = "1jl85wpgywhcvhgw02y8zpvqf0glr4i8522kxpvhsiacb1v1xh04"; + }; + }) (pkgs.vimUtils.buildVimPlugin { name = "vim-syntax-jq"; src = pkgs.fetchgit { @@ -112,7 +129,7 @@ let { command! -n=0 -bar ShowSyntax :call ShowSyntax() ''; }))) - ((rtp: rtp // { inherit rtp; }) (pkgs.write "vim-tv" { + ((rtp: rtp // { inherit rtp; }) (pkgs.write "vim-syntax-nix-nested" { "/syntax/haskell.vim".text = /* vim */ '' syn region String start=+\[[[:alnum:]]*|+ end=+|]+ @@ -222,26 +239,58 @@ let { " This is required because containedin isn't transitive. syn cluster nix_has_dollar_curly \ add=@nix_${lang}_syntax - '') { + '') (let + + capitalize = s: let + xs = stringToCharacters s; + in + toUpper (head xs) + concatStrings (tail xs); + + alts = xs: ''\(${concatStringsSep ''\|'' xs}\)''; + def = k: ''${k}[ \t\r\n]*=''; + writer = k: ''write${k}[^ \t\r\n]*[ \t\r\n]*\("[^"]*"\|[a-z]\+\)''; + + in { c = {}; cabal = {}; diff = {}; haskell = {}; - jq.extraStart = concatStringsSep ''\|'' [ - ''writeJq.*'' + jq.extraStart = alts [ + (writer "Jq") ''write[^ \t\r\n]*[ \t\r\n]*"[^"]*\.jq"'' ]; + javascript.extraStart = ''/\* js \*/''; lua = {}; - sed.extraStart = ''writeSed[^ \t\r\n]*[ \t\r\n]*"[^"]*"''; - sh.extraStart = concatStringsSep ''\|'' [ - ''write\(A\|Ba\|Da\)sh[^ \t\r\n]*[ \t\r\n]*\("[^"]*"\|[a-z]\+\)'' - ''[a-z]*Phase[ \t\r\n]*='' + python.extraStart = ''/\* py \*/''; + sed.extraStart = writer "Sed"; + sh.extraStart = let + phases = [ + "unpack" + "patch" + "configure" + "build" + "check" + "install" + "fixup" + "installCheck" + "dist" + ]; + shells = [ + "ash" + "bash" + "dash" + ]; + in alts [ + (def "shellHook") + (def "${alts phases}Phase") + (def "${alts ["pre" "post"]}${alts (map capitalize phases)}") + (writer (alts (map capitalize shells))) ]; yaml = {}; vim.extraStart = ''write[^ \t\r\n]*[ \t\r\n]*"\(\([^"]*\.\)\?vimrc\|[^"]*\.vim\)"''; xdefaults = {}; - })} + }))} " Clear syntax that interferes with nixINSIDE_DOLLAR_CURLY. syn clear shVarAssign @@ -309,6 +358,11 @@ let { paths = [ (pkgs.writeDashBin "vim" '' set -efu + export FZF_DEFAULT_COMMAND='${pkgs.ripgrep}/bin/rg --files' + export PATH=$PATH:${makeBinPath [ + pkgs.fzf + pkgs.ripgrep + ]} (umask 0077; exec ${pkgs.coreutils}/bin/mkdir -p ${toString need-dirs}) exec ${pkgs.vim}/bin/vim "$@" '') @@ -333,6 +387,7 @@ let { set shortmess+=I set showcmd set showmatch + set timeoutlen=0 set ttimeoutlen=0 set undodir=${dirs.undodir} set undofile @@ -385,5 +440,13 @@ let { noremap <esc>[c <nop> | noremap! <esc>[c <nop> noremap <esc>[d <nop> | noremap! <esc>[d <nop> vnoremap u <nop> + + " fzf + nnoremap <esc>q :Files<cr> + nnoremap <esc>w :Rg<cr> + + " edit alternate buffer + " For some reason neither putting <ctrl>6 nor <ctrl>^ works here... + nnoremap <esc>a ''; } diff --git a/tv/2configs/xp-332.nix b/tv/2configs/xp-332.nix index 627401dc6..4a0b0ae16 100644 --- a/tv/2configs/xp-332.nix +++ b/tv/2configs/xp-332.nix @@ -11,7 +11,7 @@ with import <stockholm/lib>; hardware.sane = { enable = true; extraBackends = [ - pkgs.utsushi + pkgs.utsushi-customized ]; }; @@ -19,7 +19,7 @@ with import <stockholm/lib>; elem (parseDrvName pkg.name).name [ "imagescan-plugin-networkscan" ]; nixpkgs.overlays = singleton (self: super: { - utsushi = super.utsushi.override { + utsushi-customized = self.utsushi.override { guiSupport = false; jpegSupport = false; networkSupport = true; diff --git a/tv/2configs/xserver/Xresources.nix b/tv/2configs/xserver/Xresources.nix index 1d4044480..d032efc7d 100644 --- a/tv/2configs/xserver/Xresources.nix +++ b/tv/2configs/xserver/Xresources.nix @@ -50,4 +50,9 @@ pkgs.writeText "Xresources" /* xdefaults */ '' root-urxvt*foreground: #e0c0c0 root-urxvt*BorderColor: #400000 root-urxvt*color0: #800000 + + fzmenu-urxvt*background: rgb:42/23/42 + fzmenu-urxvt*externalBorder: 1 + fzmenu-urxvt*geometry: 70x9 + fzmenu-urxvt*internalBorder: 1 '' diff --git a/tv/2configs/xserver/default.nix b/tv/2configs/xserver/default.nix index dbfa804d2..8d4b13fad 100644 --- a/tv/2configs/xserver/default.nix +++ b/tv/2configs/xserver/default.nix @@ -24,17 +24,6 @@ in { pkgs.xlibs.fontschumachermisc ]; - # TODO dedicated group, i.e. with a single user [per-user-setuid] - # TODO krebs.setuid.slock.path vs /run/wrappers/bin - krebs.setuid.slock = { - filename = "${pkgs.slock}/bin/slock"; - group = "wheel"; - envp = { - DISPLAY = ":${toString config.services.xserver.display}"; - USER = cfg.user.name; - }; - }; - services.xserver = { # Don't install feh into systemPackages @@ -57,12 +46,19 @@ in { systemd.services.display-manager.enable = false; - systemd.services.xmonad = { + systemd.services.xmonad = let + xmonad = "${pkgs.haskellPackages.xmonad-tv}/bin/xmonad"; + in { wantedBy = [ "graphical.target" ]; requires = [ "xserver.service" ]; environment = { DISPLAY = ":${toString config.services.xserver.display}"; + FZMENU_FZF_DEFAULT_OPTS = toString [ + "--color=dark,border:126,bg+:090" + "--inline-info" + ]; + XMONAD_CACHE_DIR = cfg.cacheDir; XMONAD_CONFIG_DIR = cfg.configDir; XMONAD_DATA_DIR = cfg.dataDir; @@ -88,6 +84,14 @@ in { "za" "zh" "zj" "zs" ]); }; + path = [ + config.tv.slock.package + pkgs.fzmenu + pkgs.pulseaudioLight.out + pkgs.rxvt_unicode + pkgs.xcalib + "/run/wrappers" # for su + ]; serviceConfig = { SyslogIdentifier = "xmonad"; ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p ${toString [ @@ -95,8 +99,8 @@ in { "\${XMONAD_CONFIG_DIR}" "\${XMONAD_DATA_DIR}" ]}"; - ExecStart = "${pkgs.xmonad-tv}/bin/xmonad"; - ExecStop = "${pkgs.xmonad-tv}/bin/xmonad --shutdown"; + ExecStart = "@${xmonad} xmonad-${currentSystem} "; + ExecStop = "@${xmonad} xmonad-${currentSystem} --shutdown"; User = cfg.user.name; WorkingDirectory = cfg.user.home; }; @@ -142,4 +146,9 @@ in { User = cfg.user.name; }; }; + + tv.slock = { + enable = true; + user = cfg.user; + }; } |