summaryrefslogtreecommitdiffstats
path: root/lass/5pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'lass/5pkgs')
-rw-r--r--lass/5pkgs/custom/xmonad-lass/default.nix29
-rw-r--r--lass/5pkgs/emot-menu/default.nix2
-rw-r--r--lass/5pkgs/init/default.nix45
-rwxr-xr-xlass/5pkgs/init/run-vm.sh7
-rw-r--r--lass/5pkgs/init/test.nix13
-rwxr-xr-xlass/5pkgs/init/test.sh11
6 files changed, 63 insertions, 44 deletions
diff --git a/lass/5pkgs/custom/xmonad-lass/default.nix b/lass/5pkgs/custom/xmonad-lass/default.nix
index e6d4b0664..5a741353d 100644
--- a/lass/5pkgs/custom/xmonad-lass/default.nix
+++ b/lass/5pkgs/custom/xmonad-lass/default.nix
@@ -19,6 +19,8 @@ import System.Environment (getArgs, lookupEnv)
import System.Exit (exitFailure)
import System.IO (hPutStrLn, stderr)
import System.Posix.Process (executeFile)
+import Data.Ratio
+
import XMonad.Actions.CopyWindow (copy, copyToAll, kill1)
import XMonad.Actions.CycleWS (toggleWS)
import XMonad.Actions.DynamicWorkspaces ( addWorkspacePrompt, renameWorkspace, removeEmptyWorkspace)
@@ -29,14 +31,17 @@ import XMonad.Hooks.EwmhDesktops (ewmh)
import XMonad.Hooks.FloatNext (floatNext)
import XMonad.Hooks.FloatNext (floatNextHook)
import XMonad.Hooks.ManageDocks (avoidStruts, ToggleStruts(ToggleStruts))
-import XMonad.Hooks.ManageHelpers (composeOne, doCenterFloat, (-?>))
+import XMonad.Hooks.ManageHelpers (doCenterFloat, doRectFloat, (-?>))
+import XMonad.Hooks.Place (placeHook, smart)
import XMonad.Hooks.UrgencyHook (focusUrgent)
import XMonad.Hooks.UrgencyHook (withUrgencyHook, UrgencyHook(..))
import XMonad.Layout.FixedColumn (FixedColumn(..))
+import XMonad.Layout.Grid (Grid(..))
import XMonad.Layout.Minimize (minimize)
import XMonad.Layout.NoBorders (smartBorders)
import XMonad.Layout.MouseResizableTile (mouseResizableTile)
import XMonad.Layout.SimplestFloat (simplestFloat)
+import XMonad.ManageHook (composeAll)
import XMonad.Prompt (autoComplete, font, searchPredicate, XPConfig)
import XMonad.Prompt.Window (windowPromptGoto, windowPromptBringCopy)
import XMonad.Util.EZConfig (additionalKeysP)
@@ -76,7 +81,7 @@ main' = do
{ terminal = myTerm
, modMask = mod4Mask
, layoutHook = smartBorders $ myLayoutHook
- , manageHook = floatHooks <+> floatNextHook
+ , manageHook = floatHooks
, startupHook =
whenJustM (liftIO (lookupEnv "XMONAD_STARTUP_HOOK"))
(\path -> forkFile path [] Nothing)
@@ -88,14 +93,17 @@ main' = do
myLayoutHook = defLayout
where
- defLayout = minimize $ ((avoidStruts $ Mirror (Tall 1 (3/100) (1/2))) ||| Full ||| FixedColumn 2 80 80 1 ||| Tall 1 (3/100) (1/2) ||| simplestFloat ||| mouseResizableTile)
-
-floatHooks :: Query (Endo WindowSet)
-floatHooks = composeOne
- [ className =? "Pinentry" -?> doCenterFloat
- , title =? "fzfmenu" -?> doCenterFloat
- , title =? "glxgears" -?> doCenterFloat
- , resource =? "Dialog" -?> doFloat
+ defLayout = minimize $ ((avoidStruts $ Mirror (Tall 1 (3/100) (1/2))) ||| Full ||| FixedColumn 2 80 80 1 ||| Tall 1 (3/100) (1/2) ||| simplestFloat ||| mouseResizableTile ||| Grid)
+
+floatHooks = composeAll
+ [ className =? "Pinentry" --> doCenterFloat
+ , title =? "fzfmenu" --> doCenterFloat
+ , title =? "glxgears" --> doCenterFloat
+ , resource =? "Dialog" --> doFloat
+ , title =? "Upload to Imgur" -->
+ doRectFloat (W.RationalRect 0 0 (1 % 8) (1 % 8))
+ , placeHook (smart (1,0))
+ , floatNextHook
]
myKeyMap :: [([Char], X ())]
@@ -105,7 +113,6 @@ myKeyMap =
, ("M4-p", spawn "${pkgs.pass}/bin/passmenu --type")
, ("M4-S-p", spawn "${pkgs.otpmenu}/bin/otpmenu")
, ("M4-o", spawn "${pkgs.brain}/bin/brainmenu --type")
- , ("M4-i", spawn "${pkgs.dpass}/bin/dpassmenu --type")
, ("M4-z", spawn "${pkgs.emot-menu}/bin/emoticons")
, ("<XF86AudioMute>", spawn "${pkgs.pulseaudioLight.out}/bin/pactl -- set-sink-mute @DEFAULT_SINK@ toggle")
diff --git a/lass/5pkgs/emot-menu/default.nix b/lass/5pkgs/emot-menu/default.nix
index 440e160d0..3ce635dac 100644
--- a/lass/5pkgs/emot-menu/default.nix
+++ b/lass/5pkgs/emot-menu/default.nix
@@ -29,6 +29,6 @@ writeDashBin "emoticons" ''
data=$(${coreutils}/bin/cat ${emoticons})
emoticon=$(echo "$data" | ${dmenu}/bin/dmenu | ${gnused}/bin/sed 's/ | .*//')
- ${xdotool}/bin/xdotool type -- "$emoticon"
+ ${xdotool}/bin/xdotool type --clearmodifiers -- "$emoticon"
exit 0
''
diff --git a/lass/5pkgs/init/default.nix b/lass/5pkgs/init/default.nix
index cbcfe2c00..ee49951b1 100644
--- a/lass/5pkgs/init/default.nix
+++ b/lass/5pkgs/init/default.nix
@@ -2,10 +2,10 @@
with lib;
-pkgs.writeScript "init" ''
+pkgs.writeScriptBin "init" ''
#!/usr/bin/env nix-shell
- #! nix-shell -i bash -p jq parted libxfs
- set -efu
+ #! nix-shell -i bash -p cryptsetup gptfdisk jq libxfs
+ set -xefuo pipefail
disk=$1
@@ -14,12 +14,12 @@ pkgs.writeScript "init" ''
exit 2
fi
+ bootdev="$disk"2
luksdev="$disk"3
luksmap=/dev/mapper/${luksmap}
vgname=${vgname}
- bootdev=/dev/sda2
rootdev=/dev/mapper/${vgname}-root
homedev=/dev/mapper/${vgname}-home
@@ -35,15 +35,13 @@ pkgs.writeScript "init" ''
# dd if=/dev/zero bs=512 count=34 of=/dev/sda
# TODO zero last 34 blocks (lsblk -bno SIZE /dev/sda)
if ! test "$(blkid -o value -s PTTYPE "$disk")" = gpt; then
- parted -s -a optimal "$disk" \
- mklabel gpt \
- mkpart no-fs 0 1024KiB \
- set 1 bios_grub on \
- mkpart ESP fat32 1025KiB 1024MiB set 2 boot on \
- mkpart primary 1025MiB 100%
+ sgdisk -og "$disk"
+ sgdisk -n 1:2048:4095 -c 1:"BIOS Boot Partition" -t 1:ef02 "$disk"
+ sgdisk -n 2:4096:+1G -c 2:"EFI System Partition" -t 2:ef00 "$disk"
+ sgdisk -n 3:0:0 -c 3:"LUKS container" -t 3:8300 "$disk"
fi
- if ! test "$(blkid -o value -s PARTLABEL "$luksdev")" = primary; then
+ if ! test "$(blkid -o value -s PARTLABEL "$luksdev")" = "LUKS container"; then
echo zonk2
exit 23
fi
@@ -58,7 +56,6 @@ pkgs.writeScript "init" ''
if ! test -e "$luksmap"; then
echo "$lukspw" | cryptsetup luksOpen "$luksdev" "$(basename "$luksmap")" -
fi
- # cryptsetup close
if ! test "$(blkid -o value -s TYPE "$luksmap")" = LVM2_member; then
pvcreate "$luksmap"
@@ -68,11 +65,7 @@ pkgs.writeScript "init" ''
lvchange -a y /dev/mapper/"$vgname"
- if ! test -e "$rootdev"; then lvcreate -L 7G -n root "$vgname"; fi
- if ! test -e "$homedev"; then lvcreate -L 100M -n home "$vgname"; fi
-
- # lvchange -a n "$vgname"
-
+ if ! test -e "$rootdev"; then lvcreate -L 3G -n root "$vgname"; fi
#
# formatting
@@ -82,35 +75,23 @@ pkgs.writeScript "init" ''
mkfs.vfat "$bootdev"
fi
- if ! test "$(blkid -o value -s TYPE "$rootdev")" = btrfs; then
+ if ! test "$(blkid -o value -s TYPE "$rootdev")" = xfs; then
mkfs.xfs "$rootdev"
fi
- if ! test "$(blkid -o value -s TYPE "$homedev")" = btrfs; then
- mkfs.xfs "$homedev"
- fi
-
-
if ! test "$(lsblk -n -o MOUNTPOINT "$rootdev")" = /mnt; then
+ mkdir -p /mnt
mount "$rootdev" /mnt
fi
if ! test "$(lsblk -n -o MOUNTPOINT "$bootdev")" = /mnt/boot; then
mkdir -m 0000 -p /mnt/boot
mount "$bootdev" /mnt/boot
fi
- if ! test "$(lsblk -n -o MOUNTPOINT "$homedev")" = /mnt/home; then
- mkdir -m 0000 -p /mnt/home
- mount "$homedev" /mnt/home
- fi
-
- # umount -R /mnt
#
# dependencies for stockholm
#
- nix-env -iA nixos.git
-
# TODO: get sentinal file from target_path
mkdir -p /mnt/var/src
touch /mnt/var/src/.populate
@@ -119,7 +100,7 @@ pkgs.writeScript "init" ''
# print all the infos
#
- parted "$disk" print
+ gdisk -l "$disk"
lsblk "$disk"
echo READY.
diff --git a/lass/5pkgs/init/run-vm.sh b/lass/5pkgs/init/run-vm.sh
new file mode 100755
index 000000000..13914ad5f
--- /dev/null
+++ b/lass/5pkgs/init/run-vm.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env nix-shell
+#! nix-shell -i bash -p nixos-generators
+
+set -efu
+
+WD=$(dirname "$0")
+nixos-generate -I stockholm="$WD"/../../.. -c "$WD"/config.nix -f vm-nogui --run
diff --git a/lass/5pkgs/init/test.nix b/lass/5pkgs/init/test.nix
new file mode 100644
index 000000000..e76e7e009
--- /dev/null
+++ b/lass/5pkgs/init/test.nix
@@ -0,0 +1,13 @@
+{ config, lib, pkgs, ... }:
+{
+ virtualisation.emptyDiskImages = [
+ 8000
+ ];
+ virtualisation.memorySize = 1500;
+ boot.tmpOnTmpfs = true;
+
+ environment.systemPackages = [
+ (pkgs.callPackage ./default.nix {})
+ ];
+ services.mingetty.autologinUser = lib.mkForce "root";
+}
diff --git a/lass/5pkgs/init/test.sh b/lass/5pkgs/init/test.sh
new file mode 100755
index 000000000..0ceaa73ca
--- /dev/null
+++ b/lass/5pkgs/init/test.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env nix-shell
+#! nix-shell -i bash -p nixos-generators
+
+set -xefu
+
+WD=$(realpath $(dirname "$0"))
+TMPDIR=$(mktemp -d)
+cd "$TMPDIR"
+nixos-generate -c "$WD"/test.nix -f vm-nogui --run "$@"
+cd -
+rm -r "$TMPDIR"