├── .gitignore ├── .vimrc ├── README.md ├── default.nix ├── documentation ├── dotfiles ├── i3.nix └── lilyterm.nix ├── example ├── boot.nix ├── configuration.nix ├── nixpkgs.nix ├── rice.nix └── software.nix ├── precooked.nix └── utilities ├── default.nix └── distribute.nix /.gitignore: -------------------------------------------------------------------------------- 1 | *.swo 2 | *.swp 3 | result 4 | 5 | -------------------------------------------------------------------------------- /.vimrc: -------------------------------------------------------------------------------- 1 | syntax on 2 | set expandtab 3 | set shiftwidth=2 4 | set softtabstop=2 5 | set autoindent 6 | colorscheme desert 7 | set foldmethod=marker 8 | set nu 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nix-rice 2 | 3 | ## what's ricing? 4 | 5 | Ricing, in a restricted sense, is often used to describe the act of superficially modifying a UI to give it a better design, more suited to personal preference. r/unixporn is an example of a desktop ricing community. 6 | 7 | ## what's nix-rice? 8 | 9 | The nix-rice library is a wrapper over a subset of the nixos configuration system; particularly the part of that system concerned with parameters of concern to ricing. 10 | 11 | It aims to provide a method of ricing that is portable, fool-proof and easy to read, and distributable without worries regarding security or system breakage. Here is an example of the way in which one can define an (simple) ricing configuration in a single nix-language expression: 12 | 13 | makeRice { 14 | customFiles = [{input = ./vimrc; output = userFile ".vimrc";}]; 15 | # yes, that is deterministic dotfile management! 16 | dm = makeDM.slim { 17 | background = ./backgrounds/water-drops.jpg; 18 | defaultUser = normalUser; 19 | } 20 | wm = makeWM.i3 rec { 21 | modkey = "Mod4"; 22 | appearance = 23 | { windowHeader = false; windowBorder = 3; }; 24 | font = terminal.font; 25 | terminal = makeTerminal.tilda { 26 | transparence = 0.3; 27 | font = makeFont.powerline { 28 | baseFont = "dejavu"; 29 | }; 30 | }; 31 | }; 32 | } 33 | 34 | Imagine if posts on r/unixporn all came with their own rice expression so all you had to do to try them out would be to import them into your system configuration! 35 | 36 | ## glossary of terms 37 | 38 | - world value 39 | - epistemically: represents everything an element of a ricing config could want to use. 40 | - practically: an internally referenced value constructed in utilities/default.nix, containg things like the nix package set and interal utility functions. 41 | - element 42 | - epistemically: represents a part of a ricing configuration (a terminal or window manager). 43 | - practically: a function that, given the world value, constructs a set containing a 'type' attribute and some parameters (filepaths, numbers, other elements, you name it). The type attribute it used to implement a sort of trivial type-system; builders assert that their input element is of a certain type. 44 | - constructor 45 | - epistemically: turns a set of user-specified parameters into an element; constructors are user-facing. 46 | - practically: a simple function that, given a set of necessary parameters, constructs an element. 47 | - actuator 48 | - epistemically: the effectful result of an element. 49 | - practically: a function that, given the world value, returns a set containing a 'config' attribute and a 'handles' attribute, which represent the side-effects the actuator will have on the system configuration and the return values that it may produce (and be used to construct other actuators)respectively. 50 | - builder 51 | - epistemicaly: a function that transforms an element into an actuator. 52 | - practically: a function that transforms an element into an actuator. 53 | - a rice element 54 | - a top-level element of the nix-rice system; an entire ricing configuration. 55 | - callRice 56 | - the entrypoint into the nix-rice library; builds a rice element with buildRice, supplies the result with the 'world' parameter and discards the 'handles' attribute that the actuator produces. 57 | 58 | ## description of general structure 59 | 60 | callRice, the top-most entry point into nix-rice, accepts a rice element. The rice element is constructed with 'makeRice', taking as parameter a set of elements and values, the elements of which are constructed with other constructors of a similar pattern. Thus, the construction of a rice, similar to the construction of any other element, is hierarchal and fool-proof, an error being returned from a constructor if it is not given bad parameters. 61 | 62 | For each type of element, there is a respective builder, which turns the element into an actuator; each builder calls builders for the child elements as well, the top-most builder being 'makeRice'. 63 | 64 | The various configuration sets in play are merged with lib.mkMerge. 65 | 66 | # the mission 67 | 68 | Is to go where no ricer has gone before; make a unified system for simple definition and fool-proof and deterministic deployment of ricing configurations. 69 | 70 | Thanks to everybody who showed interest in this, I'm going to go ahead and put some work into it. 71 | 72 | nix-rice on the internet! 73 | - https://www.reddit.com/r/unixporn/comments/3daem9/something_cooking_i3/ct3mn28?context=3 74 | 75 | # documentation of constructors 76 | 77 | Is available in 'documentation' file of this directory. 78 | -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | let fix = f: let x = f x; in x; in fix (self: with self; { 2 | ## PRECOOKED RICE ;) ## 3 | precooked = import ./precooked.nix self; 4 | 5 | ## CALLRICE returns a CONFIGURATION SET ## 6 | callRice = {lib, config, pkgs, user, ...}: 7 | rice: 8 | let 9 | world = import ./utilities/default.nix 10 | { inherit pkgs config lib user; }; 11 | in 12 | { 13 | options = { 14 | fonts.fonts = lib.mkOption { apply = lib.unique; }; 15 | }; 16 | config = 17 | ((world.call buildRice) rice).config; 18 | }; 19 | 20 | ## CONSTRUCTORS return ELEMENTS ## 21 | makeRice = opts: 22 | world: { type = "rice"; } // (world.call opts); 23 | makeWM.i3 = opts: 24 | world: { type = "wm"; species = "i3"; } // (world.call opts); 25 | makeTerm.lilyterm = opts: 26 | world: { type = "term"; species = "lilyterm"; } // (world.call opts); 27 | makeFont = opts: 28 | world: { type = "font"; } // (world.call opts); 29 | 30 | ## BUILDERS return ACTUATORS ## 31 | # buildRice {{{ 32 | buildRice = world: with world; 33 | mkBuilder "rice" ( 34 | rice@{ 35 | customFiles ? [], 36 | wm ? null, ...}: 37 | let 38 | wmAct = callElement buildWM wm; 39 | myconfig = { 40 | system.activationScripts = utils.distribute customFiles; 41 | }; 42 | in 43 | { 44 | config = lib.mkMerge [wmAct.config myconfig]; 45 | handles = { }; 46 | } 47 | ); # haha a frowny face 48 | # }}} 49 | 50 | # buildWM {{{ 51 | buildWM = world: with world; 52 | mkBuilder "wm" (wm@{species ? "i3", ...}: 53 | if wm.species == "i3" then 54 | callElement buildWMs.i3 wm 55 | else throw ("unknown wm species " + wm.species) 56 | ); 57 | # }}} 58 | 59 | # buildWMs.i3 {{{ 60 | buildWMs.i3 = world: with world; 61 | mkBuilder "wm" ( 62 | wm@{ 63 | font ? null, 64 | term ? null, 65 | modkey ? "Mod4", ...}: 66 | let 67 | termAct = callElement buildTerm term; 68 | fontAct = callElement buildFont font; 69 | myconfig = 70 | { 71 | services.xserver = { 72 | displayManager.slim.enable = true; 73 | windowManager.i3.enable = true; 74 | windowManager.i3.configFile = 75 | pkgs.writeTextFile { 76 | name = "config"; 77 | text = import ./dotfiles/i3.nix { 78 | inherit modkey; 79 | term = 80 | if isNull term then "xterm" else 81 | termAct.handles.out; 82 | font = 83 | if isNull font then "monospace 12" else 84 | fontAct.handles.name; 85 | }; 86 | }; 87 | autorun = true; enable = true; 88 | }; 89 | }; 90 | in 91 | { 92 | config = lib.mkMerge [myconfig termAct.config fontAct.config]; 93 | handles = {}; 94 | } 95 | ); 96 | # }}} 97 | 98 | # buildTerm {{{ 99 | buildTerm = world: with world; 100 | mkBuilder "term" (term@{species ? "lilyterm", ...}: 101 | if term.species == "lilyterm" then 102 | callElement buildTerms.lilyterm term 103 | else throw ("unknown term species " + term.species) 104 | ); 105 | # }}} 106 | 107 | # buildTerms.lilyterm {{{ 108 | buildTerms.lilyterm = world: with world; 109 | mkBuilder "term" ( 110 | term@{ 111 | browser ? "firefox", 112 | email ? "thunderbird", 113 | font ? null, ...}: 114 | let 115 | fontAct = callElement buildFont font; 116 | myconfig = { }; 117 | lilyterm-config = 118 | pkgs.writeTextFile { 119 | name = "lilyterm.config"; 120 | text = import ./dotfiles/lilyterm.nix { 121 | inherit browser email; 122 | font = 123 | if isNull font then "Monospace 12" else 124 | fontAct.handles.name; 125 | }; 126 | }; 127 | in 128 | { 129 | config = lib.mkMerge [myconfig fontAct.config]; 130 | handles = { 131 | out = 132 | pkgs.writeScript "lilyterm" '' 133 | ${pkgs.lilyterm}/bin/lilyterm -u ${lilyterm-config} 134 | ''; 135 | }; 136 | } 137 | ); 138 | # }}} 139 | 140 | # buildFont {{{ 141 | buildFont = world: with world; 142 | mkBuilder "font" (font@{name, size ? "12", ...}: 143 | let 144 | myconfig = { 145 | fonts = { 146 | enableFontDir = true; 147 | enableGhostscriptFonts = true; 148 | fonts = with pkgs; 149 | lib.optionals (name == "dejavu") [dejavu_fonts]; 150 | }; 151 | }; 152 | in 153 | { 154 | config = myconfig; 155 | handles = { 156 | name = 157 | if name == "dejavu" then 158 | "dejavu sans mono ${size}" 159 | else throw ("unknown font name " + name); 160 | }; 161 | } 162 | ); 163 | # }}} 164 | }) 165 | -------------------------------------------------------------------------------- /documentation: -------------------------------------------------------------------------------- 1 | This file documents all of the constructors implemented by this package. They are organised by the type of element that they create, and their possible parameters and respective meanings are expressed. 2 | This file should be updated as new constructors are added. Each constructor documented should obey the following canonical form: 3 | 4 | ## element short name (element long name): constructor identifier 5 | constructor identifier { 6 | parameter: description of parameter 7 | element accepted as parameter: identification of element short name 8 | } 9 | 10 | # Here are the currently supported constructors: 11 | 12 | ## rice (ricing config): makeRice 13 | makeRice { 14 | customFiles: list of {input, ouput} where input is a filepath and output is a list of filepaths 15 | wm: a wm element 16 | } 17 | 18 | ## wm (window manager): makeWM.i3 19 | makeWM.i3 { 20 | font: a font (fontfact) element 21 | term: a term (terminal) element 22 | modkey: the key used to trigger the default i3 key bindings 23 | (Mod4 is windows key, Mod3 is alt key.) 24 | } 25 | 26 | # term (terminal): makeTerm.lilyterm 27 | makeTerm.lilyterm { 28 | browser: the browser used to open http:// and ftp:// links 29 | email: the email client used to open email addresses 30 | font: a font (font face) element 31 | } 32 | 33 | # font (fontface): makeFont 34 | makeFont { 35 | name: the name of the font (current only dejavu is supported) 36 | size: the pt size of the font 37 | } 38 | -------------------------------------------------------------------------------- /dotfiles/i3.nix: -------------------------------------------------------------------------------- 1 | {modkey, term, font}: 2 | '' 3 | # modkey 4 | set $mod ${modkey} 5 | 6 | # display settings 7 | font pango:${font} 8 | new_window pixel 3 9 | 10 | # Use Mouse+$mod to drag floating windows to their wanted position 11 | floating_modifier $mod 12 | 13 | # easy access commands 14 | bindsym $mod+Return exec ${term} 15 | bindsym $mod+Shift+q kill 16 | bindsym $mod+d exec dmenu_run 17 | 18 | # change focus 19 | bindsym $mod+j focus left 20 | bindsym $mod+k focus down 21 | bindsym $mod+l focus up 22 | bindsym $mod+semicolon focus right 23 | 24 | # move focused window 25 | bindsym $mod+Shift+j move left 26 | bindsym $mod+Shift+k move down 27 | bindsym $mod+Shift+l move up 28 | bindsym $mod+Shift+semicolon move right 29 | 30 | # cursor keys 31 | bindsym $mod+Left focus left 32 | bindsym $mod+Down focus down 33 | bindsym $mod+Up focus up 34 | bindsym $mod+Right focus right 35 | bindsym $mod+Shift+Left move left 36 | bindsym $mod+Shift+Down move down 37 | bindsym $mod+Shift+Up move up 38 | bindsym $mod+Shift+Right move right 39 | 40 | # DO THE SPLITS 41 | bindsym $mod+h split h 42 | bindsym $mod+v split v 43 | 44 | # window states 45 | bindsym $mod+f fullscreen toggle 46 | bindsym $mod+Shift+space floating toggle 47 | 48 | # container layouts 49 | bindsym $mod+s layout stacking 50 | bindsym $mod+w layout tabbed 51 | bindsym $mod+e layout toggle split 52 | 53 | # focus mode (tiling / floating) 54 | bindsym $mod+space focus mode_toggle 55 | 56 | # focus parents and children 57 | bindsym $mod+a focus parent 58 | bindsym $mod+z focus child 59 | 60 | # workspace switching 61 | bindsym $mod+1 workspace 1 62 | bindsym $mod+2 workspace 2 63 | bindsym $mod+3 workspace 3 64 | bindsym $mod+4 workspace 4 65 | bindsym $mod+5 workspace 5 66 | bindsym $mod+6 workspace 6 67 | bindsym $mod+7 workspace 7 68 | bindsym $mod+8 workspace 8 69 | bindsym $mod+9 workspace 9 70 | bindsym $mod+0 workspace 10 71 | bindsym $mod+Shift+1 move container to workspace 1 72 | bindsym $mod+Shift+2 move container to workspace 2 73 | bindsym $mod+Shift+3 move container to workspace 3 74 | bindsym $mod+Shift+4 move container to workspace 4 75 | bindsym $mod+Shift+5 move container to workspace 5 76 | bindsym $mod+Shift+6 move container to workspace 6 77 | bindsym $mod+Shift+7 move container to workspace 7 78 | bindsym $mod+Shift+8 move container to workspace 8 79 | bindsym $mod+Shift+9 move container to workspace 9 80 | bindsym $mod+Shift+0 move container to workspace 10 81 | 82 | # reload, restart, quit 83 | bindsym $mod+Shift+c reload 84 | bindsym $mod+Shift+r restart 85 | bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'End X session?' -b 'yes' 'i3-msg exit'" 86 | 87 | # resize window 88 | bindsym $mod+r mode "resize" 89 | 90 | mode "resize" { 91 | bindsym j resize shrink width 10 px or 10 ppt 92 | bindsym k resize grow height 10 px or 10 ppt 93 | bindsym l resize shrink height 10 px or 10 ppt 94 | bindsym semicolon resize grow width 10 px or 10 ppt 95 | 96 | # woeful arrow keys 97 | bindsym Left resize shrink width 10 px or 10 ppt 98 | bindsym Down resize grow height 10 px or 10 ppt 99 | bindsym Up resize shrink height 10 px or 10 ppt 100 | bindsym Right resize grow width 10 px or 10 ppt 101 | 102 | # exit mode 103 | bindsym Return mode "default" 104 | bindsym Escape mode "default" 105 | } 106 | 107 | # runs the i3bar 108 | bar { } 109 | '' 110 | -------------------------------------------------------------------------------- /dotfiles/lilyterm.nix: -------------------------------------------------------------------------------- 1 | {font, browser, email}: 2 | '' 3 | [main] 4 | auto_save = 0 5 | 6 | # The version of this profile's format. DO NOT EDIT IT! 7 | version = 0.9.9.3 8 | 9 | # The default font name of vte terminal. 10 | font_name = ${font} 11 | 12 | # The default column of vte terminal. 13 | column = 159 14 | 15 | # The default row of vte terminal. 16 | row = 45 17 | 18 | # Use true opacity in vte box. 19 | # 0: do NOT use rgba, 1: force to use rgba. 20 | # Left it blank will enable it automatically 21 | # if the window manager were composited. 22 | # Disable it will disable transparent_window, too. 23 | use_rgba = 24 | 25 | # Start up with fullscreen. 26 | fullscreen = 0 27 | 28 | # Transparent window. Only enabled when the window manager were composited. 29 | transparent_window = 0 30 | 31 | # The opacity of transparent window. 32 | window_opacity = 0.050 33 | 34 | # The opacity of transparent window when inactive. 35 | # Left it blank to disable this feature. 36 | window_opacity_inactive = 37 | 38 | # Use transparent background. 39 | # It will use true transparent if the window manager were composited. 40 | transparent_background = 0 41 | 42 | # The saturation of transparent background. 43 | background_saturation = 0.150 44 | 45 | # Scroll the background image along with the text. 46 | scroll_background = 0 47 | 48 | # Sets a background image. 49 | background_image = 50 | 51 | # Confirm to execute command with -e/-x/--execute option. 52 | confirm_to_execute_command = 1 53 | 54 | # Don't need to confirm for executing a program if it's in the whitelist, 55 | # separate with . 56 | execute_command_whitelist = 57 | 58 | # Launching executed command in a new tab instead of opening a new window. 59 | execute_command_in_new_tab = 1 60 | 61 | # If a program is running on foreground, 62 | # Don't need to confirm for terminating it if it's in the whitelist, 63 | # separate with . 64 | foreground_program_whitelist = bash dash csh ksh tcsh zsh screen .ranger-wrapped 65 | 66 | # If a program is running in background, 67 | # Don't need to confirm for terminating it if it's in the whitelist, 68 | # separate with . 69 | background_program_whitelist = bash dash csh ksh tcsh zsh su .ranger-wrapped 70 | 71 | # Confirm before pasting texts to vte terminal. 72 | confirm_to_paste = 1 73 | 74 | # If the program is running on foreground,, 75 | # Don't need to confirm for pasting texts to it if it's in the whitelist, 76 | # separate with . 77 | paste_texts_whitelist = editor vi vim elvis nano emacs emacs23 nano joe ne mg ssh weechat 78 | 79 | # Confirm to close multi tabs. 80 | confirm_to_close_multi_tabs = 0 81 | 82 | # Shows [Transparent Background], [Background Saturation] 83 | # [Transparent Window] and [Window Opacity] on right click menu. 84 | show_background_menu = 1 85 | 86 | # Shows [Change the foreground color] 87 | # and [Change the background color] on right click menu. 88 | show_color_selection_menu = 1 89 | 90 | # The normal text color used in vte terminal. 91 | # You may use black, #000000 or #000000000000 here. 92 | foreground_color = 93 | 94 | # The background color used in vte terminal. 95 | # You may use black, #000000 or #000000000000 here. 96 | background_color = 97 | 98 | # Sets the background color for text which is under the cursor. 99 | # You may use black, #000000 or #000000000000 here. 100 | cursor_color = #5555b5b5e7e7 101 | 102 | # Shows [Increase window size], [Decrease window size], 103 | # [Reset to default font/size] and [Reset to system font/size] 104 | # on right click menu. 105 | show_resize_menu = 1 106 | 107 | # The ratio when resizing font via function key <+> and <->. 108 | # 0: the font size is +/- 1 when resizing. 109 | font_resize_ratio = 0.000 110 | 111 | # The ratio when resizing window via right click menu. 112 | # 0: the font size is +/- 1 when resizing window. 113 | window_resize_ratio = 1.120 114 | 115 | # When user double clicks on a text, which character will be selected. 116 | word_chars = -A-Za-z0-9_.+!@&=/~% 117 | 118 | # The lines of scrollback history. -1 means unlimited (vte >= 0.22.3). 119 | scrollback_lines = 1024 120 | 121 | # Shows scroll_bar or not. 122 | # 0: Never shows the scroll_bar; 1: Always shows the scroll_bar. 123 | # Left it blank: Hide when fullscreen, or scrollback_lines = 0. 124 | show_scroll_bar = 0 125 | 126 | # The position of scroll_bar. 127 | # 0: scroll_bar is on left; 1: scroll_bar is on right. 128 | scroll_bar_position = 1 129 | 130 | # Shows input method menu on right click menu. 131 | show_input_method_menu = 0 132 | 133 | # Shows change page name menu on right click menu. 134 | show_change_page_name_menu = 1 135 | 136 | # Shows exit menu on right click menu. 137 | show_exit_menu = 1 138 | 139 | # Enable hyperlink in vte terminal. 140 | enable_hyperlink = 1 141 | 142 | # Sets whether or not the cursor will blink in vte terminal. 143 | # 0: Follow GTK+ settings for cursor blinking. 144 | # 1: Cursor blinks. 145 | # 2: Cursor does not blink. 146 | cursor_blinks = 2 147 | 148 | # Shows copy/paste menu on right click menu. 149 | show_copy_paste_menu = 1 150 | 151 | # Embed the copy/paste menu to the main menu. 152 | embedded_copy_paste_menu = 1 153 | 154 | # Sets whether or not the terminal will beep 155 | # when the child outputs the "bl" sequence. 156 | audible_bell = 1 157 | 158 | # Sets whether or not the terminal will flash 159 | # when the child outputs the "bl" sequence. 160 | visible_bell = 1 161 | 162 | # Sets whether or not the window's urgent tag will be set 163 | # when the child outputs the "bl" sequence. 164 | urgent_bell = 1 165 | 166 | # Which string the terminal should send to an application 167 | # when the user presses the Delete or Backspace keys. 168 | # 0: VTE_ERASE_AUTO 169 | # 1: VTE_ERASE_ASCII_BACKSPACE 170 | # 2: VTE_ERASE_ASCII_DELETE 171 | # 3: VTE_ERASE_DELETE_SEQUENCE 172 | # 4: VTE_ERASE_TTY 173 | erase_binding = 2 174 | 175 | # Sets the shape of the cursor drawn. 176 | # 0: VTE_CURSOR_SHAPE_BLOCK 177 | # 1: VTE_CURSOR_SHAPE_IBEAM 178 | # 2: VTE_CURSOR_SHAPE_UNDERLINE 179 | cursor_shape = 0 180 | 181 | # The default locale used when initing a vte terminal. 182 | # You may use "zh_TW", "zh_TW.Big5", or "zh_TW.UTF-8" here. 183 | default_locale = 184 | 185 | # The locales list on right click menu, separate with . 186 | # You may use "ja_JP", "ja_JP.EUC-JP", or "ja_JP.UTF-8" here. 187 | # You may want to use "UTF-8" here if you have no locale data installed. 188 | # Left it blank will disable locale and encoding select menu items. 189 | locales_list = UTF-8 190 | 191 | # Sets what type of terminal attempts to emulate. 192 | # It will also set the TERM environment. 193 | # Unless you are interested in this feature, always use "xterm". 194 | emulate_term = xterm 195 | 196 | # The environment 'VTE_CJK_WIDTH' used when initing a vte terminal. 197 | # 0: get via environment; 1: use narrow ideograph; 2: use wide ideograph. 198 | VTE_CJK_WIDTH = 1 199 | 200 | # The geometry of window when starting. 201 | # A reasonable example value is "80x24+0+0", 202 | # witch means "WIDTH x HEIGHT {+-} XOFFSET {+-} YOFFSET", and NO SPACE in it. 203 | # Notice that it will overwrite the default column and row settings above. 204 | geometry = 205 | 206 | 207 | [page] 208 | 209 | # The max character width of page name. 210 | page_width = 16 211 | 212 | # Show the tabs bar or not. 213 | # 0: Never shows the tabs ; 1: Always shows the tabs bar. 214 | # Left it blank: Hide when fullscreen, or tabs number = 1. 215 | show_tabs_bar = 0 216 | 217 | # The position of tabs bar. 218 | # 0: Top, 1: bottom. 219 | tabs_bar_position = 0 220 | 221 | # The label of tabs will fill the tab bar. 222 | fill_tabs_bar = 0 223 | 224 | # The page name used for a new page. 225 | page_name = Terminal 226 | 227 | # The page names list used for new pages, separate with . 228 | page_names = Terminal 229 | 230 | # Reuse the page name in the page names list. 231 | reuse_page_names = 1 232 | 233 | # Shows a (number no) on the page name. 234 | page_shows_number = 1 235 | 236 | # Shows the foreground running command on the page name. 237 | page_shows_current_cmdline = 1 238 | 239 | # Shows the terminal's idea of what the window's title should be. 240 | page_shows_window_title = 1 241 | 242 | # Shows current directory on the page name. 243 | page_shows_current_dir = 1 244 | 245 | # Check if the running command is root privileges. 246 | check_root_privileges = 1 247 | 248 | # Shows current encoding on the page name. 249 | page_shows_encoding = 1 250 | 251 | # Bold the text of current page name. 252 | bold_current_page_name = 1 253 | 254 | # Bold the text of action page name. 255 | bold_action_page_name = 1 256 | 257 | # Shows the page name of current page on window title. 258 | window_title_shows_current_page = 1 259 | 260 | # Append a package name (- LilyTerm) to the window title. 261 | window_title_append_package_name = 1 262 | 263 | # Shows a close button [X] on current tab. 264 | show_close_button_on_tab = 1 265 | 266 | # Shows a close button [X] on all tabs. 267 | show_close_button_on_all_tabs = 0 268 | 269 | # Use colorful text on page. 270 | use_color_page = 1 271 | 272 | # The color used for showing Window Title on page name. 273 | # You may use black, #000000 or #000000000000 here. 274 | page_win_title_color = #9A6401 275 | 276 | # The color used for showing Running Command on page name. 277 | # You may use black, #000000 or #000000000000 here. 278 | page_cmdline_color = #1C1CDC 279 | 280 | # The color used for showing Current Dir on page name. 281 | # You may use black, #000000 or #000000000000 here. 282 | page_dir_color = #215E3E 283 | 284 | # The color used for showing Custom Tab Name on page name. 285 | # You may use black, #000000 or #000000000000 here. 286 | page_custom_color = #9C0A81 287 | 288 | # The color used for showing Root Privileges on page name. 289 | # You may use black, #000000 or #000000000000 here. 290 | page_root_color = #BE0020 291 | 292 | # The color used for showing Normal Text on page name. 293 | # You may use black, #000000 or #000000000000 here. 294 | page_normal_color = #333333 295 | 296 | 297 | [key] 298 | 299 | # Disable/Enable hyperlinks, function keys and right click menu. 300 | # Left it blank to disable this function key. 301 | disable_key_binding = Ctrl grave 302 | 303 | # Add a new tab. 304 | # Left it blank to disable this function key. 305 | new_tab_key = 306 | 307 | # Close current tab. 308 | # Left it blank to disable this function key. 309 | close_tab_key = 310 | 311 | # Rename the page name of current tab. 312 | # Left it blank to disable this function key. 313 | edit_label_key = 314 | 315 | # Find the strings matching the search regex. 316 | # Left it blank to disable this function key. 317 | find_key = Ctrl F 318 | 319 | # Find the previous string matching the search regex. 320 | # Left it blank to disable this function key. 321 | find_key_prev = Shift F3 322 | 323 | # Find the next string matching the search regex. 324 | # Left it blank to disable this function key. 325 | find_key_next = F3 326 | 327 | # Switch to prev tab. 328 | # Left it blank to disable this function key. 329 | prev_tab_key = Ctrl Page_Up 330 | 331 | # Switch to next tab. 332 | # Left it blank to disable this function key. 333 | next_tab_key = Ctrl Page_Down 334 | 335 | # Switch to first tab. 336 | # Left it blank to disable this function key. 337 | first_tab_key = Ctrl Home 338 | 339 | # Switch to last tab. 340 | # Left it blank to disable this function key. 341 | last_tab_key = Ctrl End 342 | 343 | # Move current page forward. 344 | # Left it blank to disable this function key. 345 | move_tab_forward = Ctrl bracketleft 346 | 347 | # Move current page backward. 348 | # Left it blank to disable this function key. 349 | move_tab_backward = Ctrl bracketright 350 | 351 | # Move current page to first. 352 | # Left it blank to disable this function key. 353 | move_tab_first = Ctrl Up 354 | 355 | # Move current page to last. 356 | # Left it blank to disable this function key. 357 | move_tab_last = Ctrl Down 358 | 359 | # Switch to #1 tab directly. 360 | # Left it blank to disable this function key. 361 | switch_to_tab_1 = Ctrl F1 362 | 363 | # Switch to #2 tab directly. 364 | # Left it blank to disable this function key. 365 | switch_to_tab_2 = Ctrl F2 366 | 367 | # Switch to #3 tab directly. 368 | # Left it blank to disable this function key. 369 | switch_to_tab_3 = Ctrl F3 370 | 371 | # Switch to #4 tab directly. 372 | # Left it blank to disable this function key. 373 | switch_to_tab_4 = Ctrl F4 374 | 375 | # Switch to #5 tab directly. 376 | # Left it blank to disable this function key. 377 | switch_to_tab_5 = Ctrl F5 378 | 379 | # Switch to #6 tab directly. 380 | # Left it blank to disable this function key. 381 | switch_to_tab_6 = Ctrl F6 382 | 383 | # Switch to #7 tab directly. 384 | # Left it blank to disable this function key. 385 | switch_to_tab_7 = Ctrl F7 386 | 387 | # Switch to #8 tab directly. 388 | # Left it blank to disable this function key. 389 | switch_to_tab_8 = Ctrl F8 390 | 391 | # Switch to #9 tab directly. 392 | # Left it blank to disable this function key. 393 | switch_to_tab_9 = Ctrl F9 394 | 395 | # Switch to #10 tab directly. 396 | # Left it blank to disable this function key. 397 | switch_to_tab_10 = Ctrl F10 398 | 399 | # Switch to #11 tab directly. 400 | # Left it blank to disable this function key. 401 | switch_to_tab_11 = Ctrl F11 402 | 403 | # Switch to #12 tab directly. 404 | # Left it blank to disable this function key. 405 | switch_to_tab_12 = Ctrl F12 406 | 407 | # Open a new window with current dir. 408 | # Left it blank to disable this function key. 409 | new_window = Ctrl T 410 | 411 | # Select all the text in the Vte Terminal box. 412 | # Left it blank to disable this function key. 413 | select_all = Ctrl O 414 | 415 | # Copy the text to clipboard. 416 | # Left it blank to disable this function key. 417 | copy_clipboard = Ctrl Delete 418 | 419 | # Paste the text in clipboard. 420 | # Left it blank to disable this function key. 421 | paste_clipboard = Ctrl Insert 422 | 423 | # Paste the text in the primary clipboard. 424 | # Left it blank to disable this function key. 425 | paste_clipboard in primary = Shift Insert 426 | 427 | # Increase the font size of current tab. 428 | # Left it blank to disable this function key. 429 | increase_font_size = Ctrl equal 430 | 431 | # Decrease the font size of current tab. 432 | # Left it blank to disable this function key. 433 | decrease_font_size = Ctrl minus 434 | 435 | # Reset the font of current tab to original size. 436 | # Left it blank to disable this function key. 437 | reset_font_size = Ctrl Return 438 | 439 | # Try to maximum the window to use all available space on your display. 440 | # Left it blank to disable this function key. 441 | max_window = Alt F11 442 | 443 | # Asks to place window in the fullscreen/unfullscreen state. 444 | # Left it blank to disable this function key. 445 | full_screen = Alt Return 446 | 447 | # Emulate a mouse scroll up event on Vte Terminal box. 448 | # Left it blank to disable this function key. 449 | scroll_up = Shift Left 450 | 451 | # Emulate a mouse scroll down event on Vte Terminal box. 452 | # Left it blank to disable this function key. 453 | scroll_down = Shift Right 454 | 455 | # Asks to scroll up 1 line on Vte Terminal box. 456 | # Left it blank to disable this function key. 457 | scroll_up_1_line = Shift Up 458 | 459 | # Asks to scroll down 1 line on Vte Terminal box. 460 | # Left it blank to disable this function key. 461 | scroll_down_1_line = Shift Down 462 | 463 | 464 | [color] 465 | 466 | # The main ansi color theme used in vte. 467 | # Possible values are linux, xterm, rxvt, and tango. 468 | # or left it blank to use the default settings form libvte. 469 | theme = linux 470 | 471 | # Invert the ansi colors, like invert the darkred to red, darkblue to bule. 472 | invert_color = 0 473 | 474 | # Enable the custom colors specified with Color# below. 475 | custom_theme = 0 476 | 477 | # The brightness for ansi colors used in terminal. 478 | brightness = 0.200 479 | 480 | # The brightness for ansi colors used in terminal when inactive. 481 | # Left it blank to disable this feature. 482 | inactive_brightness = 0.200 483 | 484 | # The ANSI color code for Dark Red 485 | # You may use black, #000000 or #000000000000 here. 486 | Color1 = 487 | 488 | # The ANSI color code for Dark Green 489 | # You may use black, #000000 or #000000000000 here. 490 | Color2 = 491 | 492 | # The ANSI color code for Dark Yellow 493 | # You may use black, #000000 or #000000000000 here. 494 | Color3 = 495 | 496 | # The ANSI color code for Dark Blue 497 | # You may use black, #000000 or #000000000000 here. 498 | Color4 = 499 | 500 | # The ANSI color code for Dark Magenta 501 | # You may use black, #000000 or #000000000000 here. 502 | Color5 = 503 | 504 | # The ANSI color code for Dark Cyan 505 | # You may use black, #000000 or #000000000000 here. 506 | Color6 = 507 | 508 | # The ANSI color code for Dark White 509 | # You may use black, #000000 or #000000000000 here. 510 | Color7 = 511 | 512 | # The ANSI color code for Bright Black 513 | # You may use black, #000000 or #000000000000 here. 514 | Color8 = 515 | 516 | # The ANSI color code for Bright Red 517 | # You may use black, #000000 or #000000000000 here. 518 | Color9 = 519 | 520 | # The ANSI color code for Bright Green 521 | # You may use black, #000000 or #000000000000 here. 522 | Color10 = 523 | 524 | # The ANSI color code for Bright Yellow 525 | # You may use black, #000000 or #000000000000 here. 526 | Color11 = 527 | 528 | # The ANSI color code for Bright Blue 529 | # You may use black, #000000 or #000000000000 here. 530 | Color12 = 531 | 532 | # The ANSI color code for Bright Magenta 533 | # You may use black, #000000 or #000000000000 here. 534 | Color13 = 535 | 536 | # The ANSI color code for Bright Cyan 537 | # You may use black, #000000 or #000000000000 here. 538 | Color14 = 539 | 540 | 541 | [command] 542 | 543 | # The parameters of the APPLICATION should be separated with , if any. 544 | # 545 | # method = {0,1,2} 546 | # 0: Open the hyperlink in new tab. 547 | # Use it if the command were using CLI, like w3m. 548 | # 1: Open the hyperlink with gdk_spawn_on_screen_with_pipes(). 549 | # Use it if the command were using GUI, like firefox. 550 | # 2: Open the hyperlink in new window, 551 | # Use it if you not sure. 552 | # 553 | # VTE_CJK_WIDTH = {0,1,2} 554 | # 0: get via environment 555 | # 1: use narrow ideograph 556 | # 2: use wide ideograph. 557 | # 558 | # The ENVIRONS will apply to the application, separated with , too. 559 | # 560 | # The LOCALE will apply to the application as locale environs. 561 | # You may use "zh_TW", "zh_TW.Big5", or "zh_TW.UTF-8" here. 562 | # Left it blank to use the locale environs from current page. 563 | 564 | # The web browser using for http(s):// 565 | web_browser = ${browser} 566 | web_method = 1 567 | web_VTE_CJK_WIDTH = 0 568 | web_environ = 569 | web_locale = 570 | 571 | # The ftp client using for ftp(s):// 572 | ftp_client = ${browser} 573 | wtp_method = 1 574 | ftp_VTE_CJK_WIDTH = 0 575 | ftp_environ = 576 | ftp_locale = 577 | 578 | # The file manager using for file:// and [Open current directory with file manager] 579 | file_manager = ${browser} 580 | wile_method = 1 581 | file_VTE_CJK_WIDTH = 0 582 | file_environ = 583 | file_locale = 584 | 585 | # The email client using for user@host 586 | email_client = ${email} 587 | email_method = 1 588 | email_VTE_CJK_WIDTH = 0 589 | email_environ = 590 | email_locale = 591 | '' 592 | -------------------------------------------------------------------------------- /example/boot.nix: -------------------------------------------------------------------------------- 1 | # things necessary to get the system running more or less 2 | { config, pkgs, ... }: 3 | 4 | { 5 | boot.kernelPackages = pkgs.linuxPackages_4_2; 6 | 7 | networking.nameservers = [ "8.8.8.8" ]; 8 | 9 | # list not detected hardware 10 | imports = [ ]; 11 | 12 | # hardware 13 | boot.initrd.availableKernelModules = 14 | [ "xhci_hcd" "ehci_pci" "ahci" "usb_storage" ]; 15 | boot.kernelModules = [ "kvm-intel" ]; 16 | boot.extraModulePackages = [ ]; 17 | boot.extraModprobeConfig = '' 18 | options snd_hda_intel enable=0,1 19 | ''; 20 | # boot.blacklistedKernelModules = [ "snd_pcsp" ]; 21 | swapDevices = [ ]; 22 | nix.maxJobs = 4; 23 | 24 | # bootloader and filesystem 25 | boot.loader.grub.enable = true; 26 | boot.loader.grub.version = 2; 27 | boot.loader.grub.device = "/dev/sda"; 28 | fileSystems."/".device = "/dev/disk/by-label/nixos"; 29 | 30 | # networking 31 | networking.hostName = "nixos"; 32 | networking.connman.enable = true; 33 | 34 | # internationalisation 35 | i18n = { 36 | consoleFont = "lat9w-16"; 37 | consoleKeyMap = "us"; 38 | defaultLocale = "en_US.UTF-8"; 39 | }; 40 | } 41 | -------------------------------------------------------------------------------- /example/configuration.nix: -------------------------------------------------------------------------------- 1 | # the top-level configuration set 2 | { config, pkgs, ... }: 3 | 4 | { 5 | imports = [ ./boot.nix ./software.nix ./rice.nix ]; 6 | nixpkgs.config = import ./nixpkgs.nix; 7 | } 8 | -------------------------------------------------------------------------------- /example/nixpkgs.nix: -------------------------------------------------------------------------------- 1 | # overrides packages to exactly the versioning I want 2 | { 3 | allowUnfree = true; 4 | # packageOverrides = pkgs: { 5 | # flashplayer = pkgs.flashplayer.overrideDerivation (attrs: rec { 6 | # version = "11.2.202.481"; 7 | # src = pkgs.fetchurl { 8 | # url = "http://fpdownload.adobe.com/get/flashplayer/pdc/${version}/install_flash_player_11_linux.x86_64.tar.gz"; 9 | # sha256 = "151di671xqywjif3v4hbsfw55jyd5x5qjq2zc92xw367pssi29yz"; 10 | # }; 11 | # }); 12 | # }; 13 | } 14 | -------------------------------------------------------------------------------- /example/rice.nix: -------------------------------------------------------------------------------- 1 | # this file describes my system's ricing configuration 2 | # (using http://github.com/magneticduck/nix-rice) 3 | {config, lib, pkgs, ... }: 4 | with import /home/magneticduck/git/nix-rice/default.nix; 5 | 6 | callRice {inherit config lib pkgs; user = "magneticduck";} 7 | (makeRice (world: with world; 8 | let font = makeFont { name = "dejavu"; size = "10"; }; 9 | in 10 | { 11 | wm = makeWM.i3 { 12 | inherit font; 13 | modkey = "Mod4"; 14 | appearance = { 15 | windowBorder = 3; 16 | windowTitle = false; 17 | }; 18 | # many more options can be added here 19 | term = makeTerm.lilyterm { 20 | browser = "firefox"; 21 | email = "thunderbird"; 22 | inherit font; 23 | }; 24 | }; 25 | } 26 | )) 27 | -------------------------------------------------------------------------------- /example/software.nix: -------------------------------------------------------------------------------- 1 | # this file describes how my system is, aside from its ricing 2 | { config, pkgs, ... }: 3 | 4 | let 5 | customEditors = 6 | import /home/magneticduck/git/editors {nixpkgs = pkgs;}; 7 | 8 | my_vim = 9 | pkgs.vim_configurable.customize { 10 | name = "vim"; 11 | vimrcConfig.customRC = 12 | '' 13 | syntax on 14 | set expandtab 15 | set shiftwidth=2 16 | set softtabstop=2 17 | set autoindent 18 | colorscheme desert 19 | set foldmethod=marker 20 | set nu 21 | ''; 22 | vimrcConfig.vam.pluginDictionaries = [ 23 | ]; 24 | }; 25 | in 26 | { 27 | hardware.opengl.driSupport32Bit = true; 28 | 29 | nixpkgs.config.firefox = { 30 | enableAdobeFlash = true; 31 | }; 32 | 33 | 34 | # specify vim's basic configuration 35 | environment.variables.EDITOR = "vim"; 36 | environment.variables.NIX_GHC = "/run/current-system/sw/bin/ghc"; 37 | environment.variables.NIX_GHCPKG = "/run/current-system/sw/bin/ghc-pkg"; 38 | environment.variables.NIX_GHC_DOCDIR = "/run/current-system/sw/share/doc/ghc/html"; 39 | environment.variables.NIX_GHC_LIBDIR = "/run/current-system/sw/lib/ghc-7.10.2"; 40 | 41 | # here are the packages installed on my system 42 | environment.systemPackages = 43 | let 44 | userpkgs = 45 | with pkgs; [ 46 | my_vim # vim with a wrapper to play nice with nixos 47 | atom skype 48 | wget dmenu nix-repl weechat 49 | ranger transmission_gtk vlc 50 | unzip acpi file git 51 | arandr mumble gnome3.eog 52 | emacs libreoffice 53 | ffmpeg-full 54 | lilyterm firefoxWrapper 55 | xlibs.xbacklight acpi 56 | steam # ^^ 57 | postgresql 58 | 59 | # userful for dev 60 | gcc zlib 61 | ]; 62 | myGhc = with pkgs.haskellPackages; 63 | ghcWithPackages(p: 64 | [ p.ghc-mod p.hdevtools ] # p.ncurses p.lens p.aeson p.text p.haskell-src-exts p.haddock-api ] 65 | ); 66 | haskellpkgs = 67 | with pkgs.haskellPackages; [ 68 | cabal-install myGhc stylish-haskell cabal2nix 69 | ]; 70 | editors = 71 | with customEditors; [ 72 | sublime 73 | ]; 74 | in 75 | userpkgs ++ haskellpkgs ++ editors; 76 | 77 | users.extraUsers.magneticduck = { 78 | isNormalUser = true; 79 | extraGroups = [ "wheel" ]; 80 | uid = 1000; 81 | }; 82 | 83 | virtualisation.docker.enable = true; 84 | virtualisation.docker.storageDriver = "devicemapper"; 85 | 86 | services.xserver = 87 | { layout = "us"; xkbOptions = "eurosign:e"; 88 | config = 89 | '' 90 | Section "InputClass" 91 | Identifier "Razer Abyssus" 92 | MatchProduct "Abyssus" 93 | Option "AccelerationProfile" "-1" 94 | Option "ConstantDeceleration" "5" 95 | EndSection 96 | '' ; 97 | }; 98 | } 99 | -------------------------------------------------------------------------------- /precooked.nix: -------------------------------------------------------------------------------- 1 | nix-rice: with nix-rice; 2 | { 3 | simple-i3-and-vim = 4 | makeRice (world: with world; 5 | let 6 | font = makeFont { name = "dejavu"; size = "12"; }; 7 | in 8 | { 9 | wm = makeWM.i3 { 10 | inherit font; 11 | modkey = "Mod4"; 12 | term = makeTerm.lilyterm { 13 | browser = "firefox"; 14 | email = "thunderbird"; 15 | inherit font; 16 | }; 17 | }; 18 | } 19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /utilities/default.nix: -------------------------------------------------------------------------------- 1 | ########################### UTILITIES ############################ 2 | # this expression, given a set of containing nixpkgs, the nix library, 3 | # and the system config, returns the "world" parameter over which 4 | # all elements are parameterized 5 | 6 | {pkgs, lib, config, user, ...}: 7 | 8 | (f: let x = f x; in x) 9 | (self: rec { 10 | world = self; 11 | 12 | call = x: if builtins.isFunction x then x world else x; 13 | 14 | nullActuator = { config = {}; handles = {}; }; 15 | callElement = getBuilder: element: 16 | let builder = call getBuilder; in 17 | if isNull element then nullActuator else builder element; 18 | 19 | mkBuilder = type: f: getElement: 20 | let element = (call getElement); in 21 | assert element.type == type; 22 | f element; 23 | 24 | inherit pkgs config lib user; 25 | 26 | utils = { 27 | distribute = import (./distribute.nix) {inherit pkgs;}; 28 | }; 29 | 30 | 31 | }) 32 | -------------------------------------------------------------------------------- /utilities/distribute.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | files: 3 | 4 | let 5 | inherit (pkgs.stdenv.lib) concatStrings; 6 | 7 | logfile = "/etc/nix-files"; 8 | 9 | unlines = x: concatStrings (map (y: y + "\n") x) ; 10 | activateFile = 11 | x: concatStrings (map (destination: 12 | ''echo ${destination} >> ${logfile}; mkdir -p ${destination}; 13 | rmdir ${destination}; cat ${x.input} >> ${destination};'') x.output); 14 | in 15 | 16 | # system.activationScripts 17 | if files == [] then 18 | {} 19 | else { 20 | nix-rice = unlines 21 | [ "rm -f $(cat ${logfile}); rm -f ${logfile}" 22 | (unlines (map activateFile files)) 23 | ]; 24 | } 25 | --------------------------------------------------------------------------------