Compare commits

..

No commits in common. "main" and "upgrade" have entirely different histories.

297 changed files with 8952 additions and 8334 deletions

View file

@ -1,8 +0,0 @@
#!/usr/bin/env bash
dir="$(realpath $(dirname ${BASH_SOURCE[0]})/../..)"
_nix_direnv_force_reload=1 direnv exec "$dir" true
direnv reload
# direnv reload updates the mtime of .envrc. Also update the timestamp of the
# profile_rc file to keep track that we actually are up to date.
touch $dir/.direnv/{nix,flake}-profile-*.rc

2
.envrc
View file

@ -1,2 +0,0 @@
export HE_PASSWORD=SuperDuper
use flake

1
.gitignore vendored
View file

@ -1 +0,0 @@
.direnv/

114
CHANGELOG.md Normal file
View file

@ -0,0 +1,114 @@
# Changelog
## [v0.10.0](https://github.com/divnix/devos/tree/v0.10.0) (2021-05-24)
**Implemented enhancements:**
- Providing an interface to nixpkgs.config [\#237](https://github.com/divnix/devos/issues/237)
- Making the user available in profiles [\#230](https://github.com/divnix/devos/issues/230)
- copy evaluation store paths to iso [\#195](https://github.com/divnix/devos/issues/195)
- Extract custom system builds from devosSystem out of lib [\#170](https://github.com/divnix/devos/issues/170)
- Allow setting of channel host-wide [\#117](https://github.com/divnix/devos/issues/117)
- alacritty: CSIu support [\#51](https://github.com/divnix/devos/issues/51)
**Fixed bugs:**
- Cachix timeouts + how to disable nrdxp cachix \(if needed\) [\#294](https://github.com/divnix/devos/issues/294)
- default.nix flake-compat is broken [\#285](https://github.com/divnix/devos/issues/285)
- All suites return "attribute missing" [\#282](https://github.com/divnix/devos/issues/282)
- nix is built two times [\#203](https://github.com/divnix/devos/issues/203)
- fix lib docs [\#166](https://github.com/divnix/devos/issues/166)
**Closed issues:**
- eliminate userFlakeNixOS [\#257](https://github.com/divnix/devos/issues/257)
- devos-as-library [\#214](https://github.com/divnix/devos/issues/214)
**Merged pull requests:**
- Update evalArgs to match the new planned API [\#239](https://github.com/divnix/devos/pull/239)
## [v0.9.0](https://github.com/divnix/devos/tree/v0.9.0) (2021-04-19)
**Implemented enhancements:**
- pin inputs into iso live registry [\#190](https://github.com/divnix/devos/issues/190)
- Pass 'self' to lib [\#169](https://github.com/divnix/devos/issues/169)
- doc: quickstart "ISO. What next?" [\#167](https://github.com/divnix/devos/issues/167)
- Integrate Android AOSP putting mobile under control [\#149](https://github.com/divnix/devos/issues/149)
- Inoculate host identity on first use [\#132](https://github.com/divnix/devos/issues/132)
- kubenix support [\#130](https://github.com/divnix/devos/issues/130)
- Improve Home Manager support: profiles/suites, modules, extern, flake outputs [\#119](https://github.com/divnix/devos/issues/119)
- Local CA \(between hosts\) [\#104](https://github.com/divnix/devos/issues/104)
- Q5: git annex for machine state [\#68](https://github.com/divnix/devos/issues/68)
- name space ./pkgs overlays [\#60](https://github.com/divnix/devos/issues/60)
- remap global keys easily [\#57](https://github.com/divnix/devos/issues/57)
- make pass state part of this repo's structure [\#56](https://github.com/divnix/devos/issues/56)
- Incorporate ./shells [\#38](https://github.com/divnix/devos/issues/38)
- Encrypt with \(r\)age [\#37](https://github.com/divnix/devos/issues/37)
**Fixed bugs:**
- `pathsToImportedAttrs` does not accept directories [\#221](https://github.com/divnix/devos/issues/221)
- Cachix caches aren't added to the configuration [\#208](https://github.com/divnix/devos/issues/208)
- Issues with current changelog workflow [\#205](https://github.com/divnix/devos/issues/205)
- iso: systemd service startup [\#194](https://github.com/divnix/devos/issues/194)
- Help adding easy-hls-nix to devos [\#174](https://github.com/divnix/devos/issues/174)
- `flk update` fails because of obsolete flag [\#159](https://github.com/divnix/devos/issues/159)
- Expected that not all packages are exported? [\#151](https://github.com/divnix/devos/issues/151)
- Segmentation fault when generating iso [\#150](https://github.com/divnix/devos/issues/150)
**Documentation:**
- doc: split iso [\#193](https://github.com/divnix/devos/issues/193)
- lib: can depend on pkgs \(a la nixpkgs\#pkgs/pkgs-lib\) [\#147](https://github.com/divnix/devos/pull/147)
**Closed issues:**
- FRRouting router implementation [\#154](https://github.com/divnix/devos/issues/154)
- ARM aarch64 Support [\#72](https://github.com/divnix/devos/issues/72)
## [v0.8.0](https://github.com/divnix/devos/tree/v0.8.0) (2021-03-02)
**Implemented enhancements:**
- semi automatic update for /pkgs [\#118](https://github.com/divnix/devos/issues/118)
- Home-manager external modules from flakes [\#106](https://github.com/divnix/devos/issues/106)
**Fixed bugs:**
- My emacsGcc overlay is not working [\#146](https://github.com/divnix/devos/issues/146)
- local flake registry freezes branches [\#142](https://github.com/divnix/devos/issues/142)
- nixos-option no longer works after collect garbage [\#138](https://github.com/divnix/devos/issues/138)
- Profiles imports are brittle, causing failure if imported twice [\#136](https://github.com/divnix/devos/issues/136)
## [0.7.0](https://github.com/divnix/devos/tree/0.7.0) (2021-02-20)
**Implemented enhancements:**
- add zoxide [\#53](https://github.com/divnix/devos/issues/53)
- Multiarch support? [\#17](https://github.com/divnix/devos/issues/17)
- initial multiArch support [\#18](https://github.com/divnix/devos/pull/18)
**Fixed bugs:**
- Missing shebang from flk.sh [\#131](https://github.com/divnix/devos/issues/131)
- Rename Meta Issue [\#128](https://github.com/divnix/devos/issues/128)
- specialisations break the `system` argument [\#46](https://github.com/divnix/devos/issues/46)
- Revert "Add extraArgs to lib.nixosSystem call to add system args." [\#47](https://github.com/divnix/devos/pull/47)
**Documentation:**
- update home-manager urls [\#62](https://github.com/divnix/devos/pull/62)
**Closed issues:**
- add github action for cachix build ci [\#59](https://github.com/divnix/devos/issues/59)
## [12052020](https://github.com/divnix/devos/tree/12052020) (2020-12-06)
## [07092020](https://github.com/divnix/devos/tree/07092020) (2020-07-09)
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*

18
COPYING Normal file
View file

@ -0,0 +1,18 @@
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -24,7 +24,7 @@ From there you can either install the host you want with `sudo nixos-rebuild swi
| | |
|----------------|----------------------------------------------------------|
| **Shell:** | bash / zsh |
| **Shell:** | bash / elvish |
| **DM:** | lightdm + lightdm-mini-greeter |
| **WM:** | bspwm + polybar |
| **Editor:** | nvim |
@ -36,18 +36,25 @@ From there you can either install the host you want with `sudo nixos-rebuild swi
-----
### Status: Tectonic
The planet is cooling down, and approaching stability. It is well understood, and the continents are not expected to change much more. One should expect some more localized changes, and further development.
### Status: Beta
The volcanic rock still shifts below this structure. It has not solidified and cannot yet be considered `home`
You should not expect landmarks here.
Learn to adopt Chaos.
## Shoulders
Summoning is powerful magic, and cannot be created in isolation. It stands on the [shoulders of the
following giants][giants]:
### :onion: — like the layers of an onion
- [`divnix/digga`][digga]
- [`gytis-ivaskevicius/flake-utils-plus`][fup]
- [`numtide/flake-utils`][fu]
- [`numtide/devshell`][devshell]
- [`serokell/deploy-rs`][deploy]
- [`berberman/nvfetcher`][nvfetcher]
- [`NixOS/nixpkgs`][nixpkgs]
- [`ryantm/agenix`][agenix]
- [`direnv/direnv`][direnv]
- Agenix
- direnv
:heart:
@ -66,14 +73,21 @@ https://github.com/hlissner/dotfiles
DevOS is licensed under the [MIT License][mit].
[community]: https://github.com/divnix/devos/tree/community
[core]: https://github.com/divnix/devos
[deploy]: https://github.com/serokell/deploy-rs
[devshell]: https://github.com/numtide/devshell
[digga]: https://github.com/divnix/digga
[dotfiles]: https://github.com/hlissner/dotfiles
[flake-doc]: https://github.com/NixOS/nix/blob/master/src/nix/flake.md
[flakes]: https://nixos.wiki/wiki/Flakes
[fu]: https://github.com/numtide/flake-utils
[fup]: https://github.com/gytis-ivaskevicius/flake-utils-plus
[giants]: https://en.wikipedia.org/wiki/Standing_on_the_shoulders_of_giants
[home-manager]: https://nix-community.github.io/home-manager
[mit]: https://mit-license.org
[mk-flake]: https://github.com/divnix/digga/tree/master/src/mkFlake
[nix]: https://nixos.org/manual/nix/stable
[nixos]: https://nixos.org/manual/nixos/stable
[nixpkgs]: https://github.com/NixOS/nixpkgs
[nvfetcher]: https://github.com/berberman/nvfetcher

5
bors.toml Normal file
View file

@ -0,0 +1,5 @@
status = [ "check" ]
required_approvals = 1
up_to_date_approvals = true

31
default.nix Normal file
View file

@ -0,0 +1,31 @@
let
inherit (default.inputs.nixos) lib;
default = (import ./lib/compat).defaultNix;
ciSystems = [
"aarch64-linux"
"i686-linux"
"x86_64-linux"
];
filterSystems = lib.filterAttrs
(system: _: lib.elem system ciSystems);
recurseIntoAttrsRecursive = lib.mapAttrs (_: v:
if lib.isAttrs v
then recurseIntoAttrsRecursive (lib.recurseIntoAttrs v)
else v
);
systemOutputs = lib.filterAttrs
(name: set: lib.isAttrs set
&& lib.any
(system: set ? ${system} && name != "legacyPackages")
ciSystems
)
default.outputs;
ciDrvs = lib.mapAttrs (_: system: filterSystems system) systemOutputs;
in
(recurseIntoAttrsRecursive ciDrvs) // { shell = import ./shell.nix; }

View file

@ -1,7 +0,0 @@
{
"hedns": {
"TYPE": "HEDNS",
"username": "iamanish",
"password": "$HE_PASSWORD"
}
}

View file

@ -1,59 +0,0 @@
// Providers:
var REG_NONE = NewRegistrar('none'); // No registrar.
var DNS_BIND = NewDnsProvider('bind'); // ISC BIND.
var DNS_HEDNS = NewDnsProvider('hedns');
D("lakhwara.com", REG_NONE,
DnsProvider(DNS_HEDNS),
DefaultTTL(300),
//SOA('@', 'ns1.he.net.', 'hostmaster.he.net.', 2022041702, 86400, 7200, 3600000, 86400, TTL(172800)),
A('anish', '69.61.2.203'),
A('@', '69.61.2.203'),
//A('coaching', '103.16.130.98'),
TXT('anish', 'datkey=dat://1a240a14fab2bae9c85ebad29bddc04505aaba24e5fb809c2ccb4cdf71e3a7d5'),
CNAME('fm1._domainkey', 'fm1.lakhwara.com.dkim.fmhosted.com.'),
CNAME('fm2._domainkey', 'fm2.lakhwara.com.dkim.fmhosted.com.'),
CNAME('fm3._domainkey', 'fm3.lakhwara.com.dkim.fmhosted.com.'),
MX('@', 10, 'in1-smtp.messagingengine.com.'),
MX('@', 20, 'in2-smtp.messagingengine.com.'),
//NAMESERVER('ns1.he.net.'),
//NAMESERVER('ns2.he.net.'),
//NAMESERVER('ns3.he.net.'),
//NAMESERVER('ns4.he.net.'),
//NAMESERVER('ns5.he.net.'),
TXT('@', 'v=spf1 include:spf.messagingengine.com ?all')
)
D('sealight.xyz', REG_NONE, DnsProvider(DNS_HEDNS),
DefaultTTL(86400),
//SOA('@', 'ns1.he.net.', 'hostmaster.he.net.', 2022121008, 86400, 7200, 3600000, 172800, TTL(172800)),
//NAMESERVER('ns1.he.net.'),
//NAMESERVER('ns2.he.net.'),
//NAMESERVER('ns3.he.net.'),
//NAMESERVER('ns4.he.net.'),
//NAMESERVER('ns5.he.net.'),
// capsul: helix
A('bridge', '69.61.2.203', TTL(300)),
A('rss', '69.61.2.203', TTL(300)),
A('git', '69.61.2.203', TTL(300)),
A('bin', '69.61.2.203', TTL(300)),
A('ci', '69.61.2.203', TTL(300)),
A('write', '69.61.2.203', TTL(300)),
// vultr -> nulled: lituus
A('@', '45.77.48.108', TTL(300)),
A('jitsi', '45.77.48.108', TTL(300)),
A('chat', '45.77.48.108', TTL(300)),
A('element', '45.77.48.108', TTL(300)),
A('turn', '45.77.48.108', TTL(300)),
//nullhex free email real estate
CNAME('key1._domainkey', 'key1.nullhex.com.'),
CNAME('autoconfig', 'autoconfig.nullhex.com.'),
MX('@', 10, 'smtp-in-1.nullhex.com.'),
MX('@', 20, 'smtp-in-2.nullhex.com.'),
TXT('@', 'v=spf1 a mx ~all'),
SRV('_autodiscover._tcp', 0, 1, 443, 'autodiscover.nullhex.com.'),
TXT('_dmarc', 'v=DMARC1; p=quarantine;'),
SRV('_imaps._tcp', 0, 1, 993, 'imap.nullhex.com.'),
SRV('_submissions._tcp', 0, 1, 465, 'smtp.nullhex.com.')
);

View file

@ -1,26 +0,0 @@
#!/bin/sh
if [ -z "$1" ]; then
echo "error: domain missing (sealight.xyz)"
exit 1
fi
domain="$1"
errors=""
dig +short MX "$domain" | grep -q 'smtp-in-1.nullhex.com' || errors="smtp-in-1.nullhex.com record not found"
dig +short MX "$domain" | grep -q 'smtp-in-2.nullhex.com' || errors="$errors\nsmtp-in-2.nullhex.com record not found"
dig +short TXT "$domain" | grep -q '^"v=spf1 a mx ~all"$' || errors="$errors\nspf record not found"
dig +short CNAME "key1._domainkey.$domain" | grep -q 'key1.nullhex.com' || errors="$errors\nkey1._domainkey.$domain record not found"
dig +short TXT "_dmarc.$domain" | grep -q '^"v=DMARC1; p=quarantine;"$' || errors="$errors\ndmarc TXT record is missing"
dig +short SRV "_autodiscover._tcp.$domain" | grep -q '443 autodiscover.nullhex.com.' || errors="$errors\nautodiscover SRV record is missing"
dig +short SRV "_imaps._tcp.$domain" | grep -q '993 imap.nullhex.com.' || errors="$errors\nimap SRV record is missing"
dig +short SRV "_submissions._tcp.$domain" | grep -q '465 smtp.nullhex.com.' || errors="$errors\nsmtp SRV record is missing"
dig +short CNAME "autoconfig.$domain" | grep -q 'autoconfig.nullhex.com.' || errors="$errors\nautoconfig CNAME record is missing"
if [ ! -z "$errors" ]; then
echo "$errors"
exit 1
else
echo "success! u are redy"
fi

View file

@ -1,22 +0,0 @@
; lakhwara.com Dumped Sun May 28 22:30:02 2023
;
lakhwara.com. 172800 IN SOA ns1.he.net. hostmaster.he.net. (
2022041702 ;serial
86400 ;refresh
7200 ;retry
3600000 ;expire
86400 ) ;minimum
anish.lakhwara.com. 86400 IN A 103.16.130.98
anish.lakhwara.com. 86400 IN TXT datkey=dat://1a240a14fab2bae9c85ebad29bddc04505aaba24e5fb809c2ccb4cdf71e3a7d5
fm1._domainkey.lakhwara.com. 86400 IN CNAME fm1.lakhwara.com.dkim.fmhosted.com.
fm2._domainkey.lakhwara.com. 86400 IN CNAME fm2.lakhwara.com.dkim.fmhosted.com.
fm3._domainkey.lakhwara.com. 86400 IN CNAME fm3.lakhwara.com.dkim.fmhosted.com.
lakhwara.com. 86400 IN A 103.16.130.98
lakhwara.com. 86400 IN MX 10 in1-smtp.messagingengine.com.
lakhwara.com. 86400 IN MX 20 in2-smtp.messagingengine.com.
lakhwara.com. 86400 IN NS ns1.he.net.
lakhwara.com. 86400 IN NS ns2.he.net.
lakhwara.com. 86400 IN NS ns3.he.net.
lakhwara.com. 86400 IN NS ns4.he.net.
lakhwara.com. 86400 IN NS ns5.he.net.
lakhwara.com. 86400 IN TXT "v=spf1 include:spf.messagingengine.com ?all"

View file

@ -1,30 +0,0 @@
; sealight.xyz Dumped Sat Dec 10 03:57:51 2022
;
sealight.xyz. 172800 IN SOA ns1.he.net. hostmaster.he.net. (
2022121008 ;serial
86400 ;refresh
7200 ;retry
3600000 ;expire
172800 ) ;minimum
autoconfig.sealight.xyz. 86400 IN CNAME autoconfig.nullhex.com.
bridge.sealight.xyz. 300 IN A 69.61.38.225
chat.sealight.xyz. 300 IN A 45.77.48.108
element.sealight.xyz. 300 IN A 45.77.48.108
git.sealight.xyz. 300 IN A 69.61.38.225
jitsi.sealight.xyz. 300 IN A 69.61.38.225
key1._domainkey.sealight.xyz. 86400 IN CNAME key1.nullhex.com.
rss.sealight.xyz. 300 IN A 69.61.38.225
sealight.xyz. 300 IN A 45.77.48.108
sealight.xyz. 86400 IN MX 10 smtp-in-1.nullhex.com.
sealight.xyz. 86400 IN MX 20 smtp-in-2.nullhex.com.
sealight.xyz. 172800 IN NS ns1.he.net.
sealight.xyz. 172800 IN NS ns2.he.net.
sealight.xyz. 172800 IN NS ns3.he.net.
sealight.xyz. 172800 IN NS ns4.he.net.
sealight.xyz. 172800 IN NS ns5.he.net.
sealight.xyz. 86400 IN TXT "v=spf1 a mx ~all"
turn.sealight.xyz. 300 IN A 69.61.38.225
_autodiscover._tcp.sealight.xyz. 86400 IN SRV 0 1 443 autodiscover.nullhex.com.
_dmarc.sealight.xyz. 86400 IN TXT "v=DMARC1; p=quarantine;"
_imaps._tcp.sealight.xyz. 86400 IN SRV 0 1 993 imap.nullhex.com.
_submissions._tcp.sealight.xyz. 86400 IN SRV 0 1 465 smtp.nullhex.com.

1
doc/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
book

18
doc/CONTRIBUTING.md Normal file
View file

@ -0,0 +1,18 @@
# Pull Requests
## TL;DR;
- **Target Branch**: `main`
- **Merge Policy**: [`bors`][bors] is alwyas right (→ `bors try`)
- **Docs**: every changeset is expected to contain doc updates
- **Commit Msg**: be a poet! Comprehensive and explanatory commit messages
should cover the motivation and use case in an easily understandable manner
even when read after a few months.
- **Test Driven Development**: please default to test driven development where possible.
### Within the Devshell (`nix develop`)
- **Hooks**: please `git commit` within the devshell
- **Fail Early**: please run from within the devshell on your local machine:
- `nix flake check`
[bors]: https://bors.tech

28
doc/SUMMARY.md Normal file
View file

@ -0,0 +1,28 @@
# Summary
- [Introduction](../README.md)
- [Quick Start](./start/index.md)
- [ISO](./start/iso.md)
- [Bootstrapping](./start/bootstrapping.md)
- [From NixOS](./start/from-nixos.md)
- [Key Concepts](./concepts/index.md)
- [Hosts](./concepts/hosts.md)
- [Overrides](./concepts/overrides.md)
- [Profiles](./concepts/profiles.md)
- [Suites](./concepts/suites.md)
- [Users](./concepts/users.md)
- [Outputs](./outputs/index.md)
- [Modules](./outputs/modules.md)
- [Overlays](./outputs/overlays.md)
- [Packages](./outputs/pkgs.md)
- [Concerns]()
- [Secrets](./secrets.md)
- [Tests](./tests.md)
- [Helper Script `bud`](./bud/index.md)
- [get](./bud/get.md)
- [Integrations](./integrations/index.md)
- [Cachix](./integrations/cachix.md)
- [Deploy RS](./integrations/deploy.md)
- [NvFetcher](./integrations/nvfetcher.md)
- [Hercules CI](./integrations/hercules.md)
- [Contributing](./CONTRIBUTING.md)

6
doc/book.toml Normal file
View file

@ -0,0 +1,6 @@
[book]
authors = ["Timothy DeHerrera"]
language = "en"
multilingual = false
src = "."
title = "devos docs"

10
doc/bud/get.md Normal file
View file

@ -0,0 +1,10 @@
# get
The `get` subcommand is useful for getting a bare copy of devos without the
git history.
## Usage
```sh
bud get DEST-DIR
```
If DEST-DIR is ommitted, it defaults to _./devos_.

24
doc/bud/index.md Normal file
View file

@ -0,0 +1,24 @@
# [`bud`][bud] command
The template incudes a convenient script for managing your system called [`bud`][bud].
It is a portable and highly composable system control tool that work anywhere on your host
or in the flake's devshell.
Although it comes with some predefined standard helpers,
it is very extensible and you are encouraged to write your own script snippets
to ease your workflows. An example is the bud module for a `get` command that
comes included with `devos`.
While writing scripts you can convenientely access smart environment variables
that can tell the current architecture, user or host name, among others, regardless
wether you invoke `bud` within the devshell or as the system-wide installed `bud`.
For details, please review the [bud repo][bud].
## Usage
```sh
bud help
```
[bud]: https://github.com/divnix/bud

62
doc/concepts/hosts.md Normal file
View file

@ -0,0 +1,62 @@
# Hosts
Nix flakes contain an output called `nixosConfigurations` declaring an
attribute set of valid NixOS systems. To simplify the management and creation
of these hosts, devos automatically imports every _.nix_ file inside this
directory to the mentioned attribute set, applying the projects defaults to
each. The only hard requirement is that the file contain a valid NixOS module.
As an example, a file `hosts/system.nix` or `hosts/system/default.nix` will
be available via the flake output `nixosConfigurations.system`. You can have
as many hosts as you want and all of them will be automatically imported based
on their name.
For each host, the configuration automatically sets the `networking.hostName`
attribute to the folder name or name of the file minus the _.nix_ extension. This
is for convenience, since `nixos-rebuild` automatically searches for a configuration
matching the current systems hostname if one is not specified explicitly.
You can set channels, systems, and add extra modules to each host by editing the
`nixos.hosts` argument in flake.nix. This is the perfect place to import
host specific modules from external sources, such as the
[nixos-hardware][nixos-hardware] repository.
It is recommended that the host modules only contain configuration information
specific to a particular piece of hardware. Anything reusable across machines
is best saved for [profile modules](./profiles.md).
This is a good place to import sets of profiles, called [suites](./suites.md),
that you intend to use on your machine.
## Example
flake.nix:
```nix
{
nixos = {
imports = [ (devos.lib.importHosts ./hosts) ];
hosts = {
librem = {
channelName = "latest";
modules = [ nixos-hardware.nixosModules.purism-librem-13v3 ];
};
};
};
}
```
hosts/librem.nix:
```nix
{ suites, ... }:
{
imports = suites.laptop;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
fileSystems."/" = { device = "/dev/disk/by-label/nixos"; };
}
```
[nixos-hardware]: https://github.com/NixOS/nixos-hardware

10
doc/concepts/index.md Normal file
View file

@ -0,0 +1,10 @@
# Key Concepts
Key concepts are derived from [digga][digga]. Please refer to its
[docs][digga-docs] for more details.
This section is dedicated to helping you develop a more hands on
understanding of them them.
[digga-docs]: https://digga.divnix.com
[digga]: https://github.com/divnix/digga

42
doc/concepts/overrides.md Normal file
View file

@ -0,0 +1,42 @@
# Overrides
Each NixOS host follows one channel. But many times it is useful to get packages
or modules from different channels.
## Packages
You can make use of `overlays/overrides.nix` to override specific packages in the
default channel to be pulled from other channels. That file is simply an example
of how any overlay can get `channels` as their first argument.
You can add overlays to any channel to override packages from other channels.
Pulling the manix package from the `latest` channel:
```nix
channels: final: prev: {
__dontExport = true;
inherit (pkgs.latest) manix;
}
```
It is recommended to set the `__dontExport` property for override specific
overlays. `overlays/overrides.nix` is the best place to consolidate all package
overrides and the property is already set for you.
## Modules
You can also pull modules from other channels. All modules have access to the
`modulesPath` for each channel as `<channelName>ModulesPath`. And you can use
`disabledModules` to remove modules from the current channel.
To pull zsh module from the `latest` channel this code can be placed in any module, whether its your host file, a profile, or a module in ./modules etc:
```nix
{ latestModulesPath }:
{
imports = [ "${latestModulesPath}/programs/zsh/zsh.nix" ];
disabledModules = [ "programs/zsh/zsh.nix" ];
}
```
> ##### _Note:_
> Sometimes a modules name will change from one branch to another.
[nixpkgs-modules]: https://github.com/NixOS/nixpkgs/tree/master/nixos/modules

67
doc/concepts/profiles.md Normal file
View file

@ -0,0 +1,67 @@
# Profiles
Profiles are a convenient shorthand for the [_definition_][definition] of
[options][options] in contrast to their [_declaration_][declaration]. They're
built into the NixOS module system for a reason: to elegantly provide a clear
separation of concerns.
## Creation
Profiles are created with the `rakeLeaves` function which recursively collects
`.nix` files from within a folder. The recursion stops at folders with a `default.nix`
in them. You end up with an attribute set with leaves(paths to profiles) or
nodes(attrsets leading to more nodes or leaves).
A profile is used for quick modularization of [interelated bits](./profiles.md#subprofiles).
> ##### _Notes:_
> * For _declaring_ module options, there's the [modules](../outputs/modules.md) directory.
> * This directory takes inspiration from
> [upstream](https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/profiles)
> .
### Nested profiles
Profiles can be nested in attribute sets due to the recursive nature of `rakeLeaves`.
This can be useful to have a set of profiles created for a specific purpose. It is
sometimes useful to have a `common` profile that has high level concerns related
to all its sister profiles.
### Example
profiles/develop/common.nix:
```nix
{
imports = [ ./zsh ];
# some generic development concerns ...
}
```
profiles/develop/zsh.nix:
```nix
{ ... }:
{
programs.zsh.enable = true;
# zsh specific options ...
}
```
The examples above will end up with a profiles set like this:
```nix
{
develop = {
common = ./profiles/develop/common.nix;
zsh = ./profiles/develop/zsh.nix;
};
}
```
## Conclusion
Profiles are the most important concept in DevOS. They allow us to keep our
Nix expressions self contained and modular. This way we can maximize reuse
across hosts while minimizing boilerplate. Remember, anything machine
specific belongs in your [host](hosts.md) files instead.
[definition]: https://nixos.org/manual/nixos/stable/index.html#sec-option-definitions
[declaration]: https://nixos.org/manual/nixos/stable/index.html#sec-option-declarations
[options]: https://nixos.org/manual/nixos/stable/index.html#sec-writing-modules
[spec]: https://github.com/divnix/devos/tree/core/lib/devos/mkProfileAttrs.nix
[config]: https://nixos.wiki/wiki/Module#structure

25
doc/concepts/suites.md Normal file
View file

@ -0,0 +1,25 @@
# Suites
Suites provide a mechanism for users to easily combine and name collecitons of
profiles.
`suites` are defined in the `importables` argument in either the `home` or `nixos`
namespace. They are a special case of an `importable` which get passed as a special
argument (one that can be use in an `imports` line) to your hosts. All lists defined
in `suites` are flattened and type-checked as paths.
## Definition
```nix
rec {
workstation = [ profiles.develop profiles.graphical users.nixos ];
mobileWS = workstation ++ [ profiles.laptop ];
}
```
## Usage
`hosts/my-laptop.nix`:
```nix
{ suites, ... }:
{
imports = suites.mobileWS;
}
```

77
doc/concepts/users.md Normal file
View file

@ -0,0 +1,77 @@
> ##### _Note:_
> This section and its semantics need a conceptiual rework.
> Since recently [portable home configurations][portableuser]
> that are not bound to any specific host are a thing.
# Users
Users are a special case of [profiles](profiles.md) that define system
users and [home-manager][home-manager] configurations. For your convenience,
home manager is wired in by default so all you have to worry about is declaring
your users. For a fully fleshed out example, check out the developers personal
[branch](https://github.com/divnix/devos/tree/nrd/users/nrd/default.nix).
## Basic Usage
`users/myuser/default.nix`:
```nix
{ ... }:
{
users.users.myuser = {
isNormalUser = true;
};
home-manager.users.myuser = {
programs.mpv.enable = true;
};
}
```
## Home Manager
Home Manager support follows the same principles as regular nixos configurations,
it even gets its own namespace in your `flake.nix` as `home`.
All modules defined in [user modules][modules-list] will be imported to
Home Manager.
User profiles can be collected in a similar fashion as system ones into a `suites`
argument that gets passed to your home-manager users.
### Example
```nix
{
home-manager.users.nixos = { suites, ... }: {
imports = suites.base;
};
}
```
## External Usage
You can easily use the defined home-manager configurations outside of NixOS
using the `homeConfigurations` flake output. The [flk](../flk/index.md) helper
script makes this even easier.
This is great for keeping your environment consistent across Unix systems,
including OSX.
### From within the projects devshell:
```sh
# builds the nixos user defined in the NixOS host
flk home NixOS nixos
# build and activate
flk home NixOS nixos switch
```
### Manually from outside the project:
```sh
# build
nix build "github:divnix/devos#homeConfigurations.nixos@NixOS.home.activationPackage"
# activate
./result/activate && unlink result
```
[home-manager]: https://nix-community.github.io/home-manager
[modules-list]: https://github.com/divnix/devos/tree/core/users/modules/module-list.nix
[portableuser]: https://digga.divnix.com/api-reference-home.html#homeusers

View file

@ -0,0 +1,17 @@
# Cachix
The system will automatically pull a cachix.nix at the root if one exists.
This is usually created automatically by a `sudo cachix use`. If you're more
inclined to keep the root clean, you can drop any generated files in the
`cachix` directory into the `profiles/cachix` directory without further
modification.
For example, to add your own cache, assuming the template lives in /etc/nixos,
by simply running `sudo cachix use yourcache`. Then, optionally, move
`cachix/yourcache.nix` to `profiles/cachix/yourcache.nix`
These caches are only added to the system after a `nixos-rebuild switch`, so it
is recommended to call `cachix use nrdxp` before the initial deployment, as it
will save a lot of build time.
In the future, users will be able to skip this step once the ability to define
the nix.conf within the flake is fully fleshed out upstream.

View file

@ -0,0 +1,49 @@
# deploy-rs
[Deploy-rs][d-rs] is a tool for managing NixOS remote machines. It was
chosen for devos after the author experienced some frustrations with the
stateful nature of nixops' db. It was also designed from scratch to support
flake based deployments, and so is an excellent tool for the job.
By default, all the [hosts](../concepts/hosts.md) are also available as deploy-rs nodes,
configured with the hostname set to `networking.hostName`; overridable via
the command line.
## Usage
Just add your ssh key to the host:
```nix
{ ... }:
{
users.users.${sshUser}.openssh.authorizedKeys.keyFiles = [
../secrets/path/to/key.pub
];
}
```
And the private key to your user:
```nix
{ ... }:
{
home-manager.users.${sshUser}.programs.ssh = {
enable = true;
matchBlocks = {
${host} = {
host = hostName;
identityFile = ../secrets/path/to/key;
extraOptions = { AddKeysToAgent = "yes"; };
};
};
}
}
```
And run the deployment:
```sh
deploy "flk#hostName" --hostname host.example.com
```
> ##### _Note:_
> Your user will need **passwordless** sudo access
[d-rs]: https://github.com/serokell/deploy-rs

View file

@ -0,0 +1,36 @@
# Hercules CI
If you start adding your own packages and configurations, you'll probably have
at least a few binary artifacts. With hercules we can build every package in
our configuration automatically, on every commit. Additionally, we can have it
upload all our build artifacts to a binary cache like [cachix][cachix].
This will work whether your copy is a fork, or a bare template, as long as your
repo is hosted on GitHub.
## Setup
Just head over to [hercules-ci.com](https://hercules-ci.com) to make an account.
Then follow the docs to set up an [agent][agent], if you want to deploy to a
binary cache (and of course you do), be sure _not_ to skip the
[binary-caches.json][cache].
## Ready to Use
The repo is already set up with the proper _default.nix_ file, building all
declared packages, checks, profiles and shells. So you can see if something
breaks, and never build the same package twice!
If you want to get fancy, you could even have hercules
[deploy your configuration](https://docs.hercules-ci.com/hercules-ci-effects/guide/deploy-a-nixos-machine/)!
> ##### _Note:_
> Hercules doesn't have access to anything encrypted in the
> [secrets folder](../../secrets), so none of your secrets will accidentally get
> pushed to a cache by mistake.
>
> You could pull all your secrets via your user, and then exclude it from
> [allUsers](https://github.com/nrdxp/devos/blob/nrd/suites/default.nix#L17)
> to keep checks passing.
[agent]: https://docs.hercules-ci.com/hercules-ci/getting-started/#github
[cache]: https://docs.hercules-ci.com/hercules-ci/getting-started/deploy/nixos/#_3_configure_a_binary_cache
[cachix]: https://cachix.org

View file

@ -0,0 +1,5 @@
# Integrations
This section explores some of the optional tools included with devos to provide
a solution to common concerns such as ci and remote deployment. An effort is
made to choose tools that treat nix, and where possible flakes, as first class
citizens.

View file

@ -0,0 +1,43 @@
# nvfetcher
[NvFetcher][nvf] is a workflow companion for updating nix sources.
You can specify an origin source and an update configuration, and
nvfetcher can for example track updates to a specific branch and
automatically update your nix sources configuration on each run
to the tip of that branch.
All package source declaration is done in [sources.toml][sources.toml].
From within the devshell of this repo, run `nvfetcher`, a wrapped
version of `nvfetcher` that knows where to find and place its files
and commit the results.
## Usage
Statically fetching (not tracking) a particular tag from a github repo:
```toml
[manix]
src.manual = "v0.6.3"
fetch.github = "mlvzk/manix"
```
Tracking the latest github _release_ from a github repo:
```toml
[manix]
src.github = "mlvzk/manix" # responsible for tracking
fetch.github = "mlvzk/manix" # responsible for fetching
```
Tracking the latest commit of a git repository and fetch from a git repo:
```toml
[manix]
src.git = "https://github.com/mlvzk/manix.git" # responsible for tracking
fetch.git = "https://github.com/mlvzk/manix.git" # responsible for fetching
```
> ##### _Note:_
> Please refer to the [NvFetcher Readme][nvf-readme] for more options.
[nvf]: https://github.com/berberman/nvfetcher
[nvf-readme]: https://github.com/berberman/nvfetcher#readme
[sources.toml]: https://github.com/divnix/devos/tree/core/pkgs/sources.toml

3
doc/outputs/index.md Normal file
View file

@ -0,0 +1,3 @@
# Layout
Each of the following sections is a directory whose contents are output to the
outside world via the flake's outputs. Check each chapter for details.

79
doc/outputs/modules.md Normal file
View file

@ -0,0 +1,79 @@
# Modules
The modules directory is a replica of nixpkg's NixOS [modules][nixpkgs-modules]
, and follows the same semantics. This allows for trivial upstreaming into
nixpkgs proper once your module is sufficiently stable.
All modules linked in _module-list.nix_ are automatically exported via
`nixosModules.<file-basename>`, and imported into all [hosts](../concepts/hosts.md).
> ##### _Note:_
> This is reserved for declaring brand new module options. If you just want to
> declare a coherent configuration of already existing and related NixOS options
> , use [profiles](../concepts/profiles.md) instead.
## Semantics
In case you've never written a module for nixpkgs before, here is a brief
outline of the process.
### Declaration
modules/services/service-category/my-service.nix:
```nix
{ config, lib, ... }:
let
cfg = config.services.myService;
in
{
options.services.myService = {
enable = lib.mkEnableOption "Description of my new service.";
# additional options ...
};
config = lib.mkIf cfg.enable {
# implementation ...
};
}
```
### Import
modules/module-list.nix:
```nix
[
./services/service-category/my-service.nix
]
```
## Usage
### Internal
profiles/profile-category/my-profile.nix:
```nix
{ ... }:
{
services.MyService.enable = true;
}
```
### External
flake.nix:
```nix
{
# inputs omitted
outputs = { self, devos, nixpkgs, ... }: {
nixosConfigurations.myConfig = nixpkgs.lib.nixosSystem {
system = "...";
modules = [
devos.nixosModules.my-service
({ ... }: {
services.MyService.enable = true;
})
];
};
};
}
```
[nixpkgs-modules]: https://github.com/NixOS/nixpkgs/tree/master/nixos/modules

25
doc/outputs/overlays.md Normal file
View file

@ -0,0 +1,25 @@
# Overlays
Writing overlays is a common occurence when using a NixOS system. Therefore,
we want to keep the process as simple and straightforward as possible.
Any _.nix_ files declared in this directory will be assumed to be a valid
overlay, and will be automatically imported into all [hosts](../concepts/hosts.md), and
exported via `overlays.<channel>/<pkgName>` _as well as_
`packages.<system>.<pkgName>` (for valid systems), so all you have to do is
write it.
## Example
overlays/kakoune.nix:
```nix
final: prev: {
kakoune = prev.kakoune.override {
configure.plugins = with final.kakounePlugins; [
(kak-fzf.override { fzf = final.skim; })
kak-auto-pairs
kak-buffers
kak-powerline
kak-vertical-selection
];
};
}
```

109
doc/outputs/pkgs.md Normal file
View file

@ -0,0 +1,109 @@
# Packages
Similar to [modules](./modules.md), the pkgs directory mirrors the upstream
[nixpkgs/pkgs][pkgs], and for the same reason; if you ever want to upstream
your package, it's as simple as dropping it into the nixpkgs/pkgs directory.
The only minor difference is that, instead of adding the `callPackage` call to
`all-packages.nix`, you just add it the the _default.nix_ in this directory,
which is defined as a simple overlay.
All the packages are exported via `packages.<system>.<pkg-name>`, for all
the supported systems listed in the package's `meta.platforms` attribute.
And, as usual, every package in the overlay is also available to any NixOS
[host](../concepts/hosts.md).
Another convenient difference is that it is possible to use
[nvfetcher](https://github.com/berberman/nvfetcher) to keep packages up to
date.
This is best understood by the simple example below.
## Example
It is possible to specify sources separately to keep them up to date semi
automatically.
The basic rules are specified in pkgs/sources.toml:
```toml
# nvfetcher.toml
[libinih]
src.github = "benhoyt/inih"
fetch.github = "benhoyt/inih"
```
After changes to this file as well as to update the packages specified in there run
nvfetcher (for more details see [nvfetcher](https://github.com/berberman/nvfetcher)).
The pkgs overlay is managed in
pkgs/default.nix:
```nix
final: prev: {
# keep sources first, this makes sources available to the pkgs
sources = prev.callPackage (import ./_sources/generated.nix) { };
# then, call packages with `final.callPackage`
libinih = prev.callPackage ./development/libraries/libinih { };
}
```
Lastly the example package is in
pkgs/development/libraries/libinih/default.nix:
```nix
{ stdenv, meson, ninja, lib, sources, ... }:
stdenv.mkDerivation {
pname = "libinih";
# version will resolve to the latest available on gitub
inherit (sources.libinih) version src;
buildInputs = [ meson ninja ];
# ...
}
```
## Migration from flake based approach
Previous to nvfetcher it was possible to manage sources via a pkgs/flake.nix, the main changes from there are that sources where in the attribute "srcs" (now "sources") and the contents of the sources where slightly different.
In order to switch to the new system, rewrite pkgs/flake.nix to a pkgs/sources.toml file using the documentation of nvfetcher,
add the line that calls the sources at the beginning of pkgs/default.nix, and
accomodate the small changes in the packages as can be seen from the example.
The example package looked like:
pkgs/flake.nix:
```nix
{
description = "Package sources";
inputs = {
libinih.url = "github:benhoyt/inih/r53";
libinih.flake = false;
};
}
```
pkgs/default.nix:
```nix
final: prev: {
# then, call packages with `final.callPackage`
libinih = prev.callPackage ./development/libraries/libinih { };
}
```
pkgs/development/libraries/libinih/default.nix:
```nix
{ stdenv, meson, ninja, lib, srcs, ... }:
let inherit (srcs) libinih; in
stdenv.mkDerivation {
pname = "libinih";
# version will resolve to 53, as specified in the flake.nix file
inherit (libinih) version;
src = libinih;
buildInputs = [ meson ninja ];
# ...
}
```
[pkgs]: https://github.com/NixOS/nixpkgs/tree/master/pkgs

110
doc/secrets.md Normal file
View file

@ -0,0 +1,110 @@
# Secrets
Secrets are managed using [git-crypt][git-crypt] and [agenix][agenix]
so you can keep your flake in a public repository like GitHub without
exposing your password or other sensitive data.
By default, everything in the secrets folder is automatically encrypted. Just
be sure to run `git-crypt init` before putting anything in here.
## Agenix
Currently, there is [no mechanism][secrets-issue] in nix itself to deploy secrets
within the nix store because it is world-readable.
Most NixOS modules have the ability to set options to files in the system, outside
the nix store, that contain sensitive information. You can use [agenix][agenix]
to easily setup those secret files declaratively.
[agenix][agenix] encrypts secrets and stores them as .age files in your repository.
Age files are encrypted with multiple ssh public keys, so any host or user with a
matching ssh private key can read the data. The [age module][age module] will add those
encrypted files to the nix store and decrypt them on activation to `/run/secrets`.
### Setup
All hosts must have openssh enabled, this is done by default in the core profile.
You need to populate your `secrets/secrets.nix` with the proper ssh public keys.
Be extra careful to make sure you only add public keys, you should never share a
private key!!
secrets/secrets.nix:
```nix
let
system = "<system ssh key>";
user = "<user ssh key>";
allKeys = [ system user ];
in
```
On most systems, you can get your systems ssh public key from `/etc/ssh/ssh_host_ed25519_key.pub`. If
this file doesn't exist you likely need to enable openssh and rebuild your system.
Your users ssh public key is probably stored in `~/.ssh/id_ed25519.pub` or
`~/.ssh/id_rsa.pub`. If you haven't generated a ssh key yet, be sure do so:
```sh
ssh-keygen -t ed25519
```
> ##### _Note:_
> The underlying tool used by agenix, rage, doesn't work well with password protected
> ssh keys. So if you have lots of secrets you might have to type in your password many
> times.
### Secrets
You will need the `agenix` command to create secrets. DevOS conveniently provides that
in the devShell, so just run `nix develop` whenever you want to edit secrets. Make sure
to always run `agenix` while in the `secrets/` folder, so it can pick up your `secrets.nix`.
To create secrets, simply add lines to your `secrets/secrets.nix`:
```
let
...
allKeys = [ system user ];
in
{
"secret.age".publicKeys = allKeys;
}
```
That would tell agenix to create a `secret.age` file that is encrypted with the `system`
and `user` ssh public key.
Then go into the `secrets` folder and run:
```sh
agenix -e secret.age
```
This will create the `secret.age`, if it doesn't already exist, and allow you to edit it.
If you ever change the `publicKeys` entry of any secret make sure to rekey the secrets:
```sh
agenix --rekey
```
### Usage
Once you have your secret file encrypted and ready to use, you can utilize the [age module][age module]
to ensure that your secrets end up in `/run/secrets`.
In any profile that uses a NixOS module that requires a secret you can enable a particular secret like so:
```nix
{ self, ... }:
{
age.secrets.mysecret.file = "${self}/secrets/mysecret.age";
}
```
Then you can just pass the path `/run/secrets/mysecret` to the module.
You can make use of the many options provided by the age module to customize where and how
secrets get decrypted. You can learn about them by looking at the
[age module][age module].
> ##### _Note:_
> You can take a look at the [agenix repository][agenix] for more information
> about the tool.
[git-crypt]: https://github.com/AGWA/git-crypt
[agenix]: https://github.com/ryantm/agenix
[age module]: https://github.com/ryantm/agenix/blob/master/modules/age.nix
[secrets-issue]: https://github.com/NixOS/nix/issues/8

102
doc/start/bootstrapping.md Normal file
View file

@ -0,0 +1,102 @@
# Bootstrapping
This will help you boostrap a bare host with the help of the
[bespoke iso](./iso.md) live installer.
_Note: nothing prevents you from remotely executing the boostrapping
process. See below._
Once your target host has booted into the live iso, you need to partion
and format your disk according to the [official manual][manual].
## Mount partitions
Then properly mount the formatted partitions at `/mnt`, so that you can
install your system to those new partitions.
Mount `nixos` partition to `/mnt` and &mdash; for UEFI &mdash; `boot`
partition to `/mnt/boot`:
```console
$ mount /dev/disk/by-label/nixos /mnt
$ mkdir -p /mnt/boot && mount /dev/disk/by-label/boot /mnt/boot # UEFI only
$ swapon /dev/disk/by-label/swap
```
Add some extra space to the store. In the iso, it's running on a tmpfs
off your RAM:
```console
$ mkdir -p /mnt/tmpstore/{work,store}
$ mount -t overlay overlay -olowerdir=/nix/store,upperdir=/mnt/tmpstore/store,workdir=/mnt/tmpstore/work /nix/store
```
## Install
Install off of a copy of devos from the time the iso was built:
```console
$ cd /iso/devos
$ nixos-install --flake .#NixOS
```
## Notes of interest
### Remote access to the live installer
The iso live installer comes preconfigured with a network configuration
which announces it's hostname via [MulticastDNS][mDNS] as `hostname.local`,
that is `bootstrap.local` in the [iso example](./iso).
In the rare case that [MulticastDNS][mDNS] is not availabe or turned off
in your network, there is a static link-local IPv6 address configured to
`fe80::47`(mnemonic from the letter's position in the english alphabet:
`n=14 i=9 x=24; 47 = n+i+x`).
Provided that you have added your public key to the authorized keys of the
`root` user _(hint: [`deploy-rs`](../integrations/deploy.md) needs passwordless
sudo access)_:
```nix
{ ... }:
{
users.users.root.openssh.authorizedKeys.keyFiles = [
../secrets/path/to/key.pub
];
}
```
You can then ssh into the live installer through one of the
following options:
```console
ssh root@bootstrap.local
ssh root@fe80::47%eno1 # where eno1 is your network interface on which you are linked to the target
```
_Note: the [static link-local IPv6 address][staticLLA] and [MulticastDNS][mDNS] is only
configured on the live installer. If you wish to enable [MulticastDNS][mDNS]
for your environment, you ought to configure that in a regular [profile](../concepts/profiles.md)._
### EUI-64 LLA & Host Identity
The iso's IPv6 Link Local Address (LLA) is configured with a static 64-bit Extended
Unique Identifiers (EUI-64) that is derived from the host interface's Message
Authentication Code (MAC) address.
After a little while (a few seconds), you can remotely discover this unique and host
specific address over [NDP][NDP] for example with:
```console
ip -6 neigh show # also shows fe80::47
```
***This LLA is stable for the host, unless you need to swap that particular network card.***
Under this reservation, though, you may use this EUI-64 to wire up a specific
(cryptographic) host identity.
[manual]: https://nixos.org/manual/nixos/stable/index.html#sec-installation-partitioning
[mDNS]: https://en.wikipedia.org/wiki/Multicast_DNS
[NDP]: https://en.wikipedia.org/wiki/Neighbor_Discovery_Protocol
[staticLLA]: https://tools.ietf.org/html/rfc7404

54
doc/start/from-nixos.md Normal file
View file

@ -0,0 +1,54 @@
# From NixOS
## Generate Configuration
Assuming you're happy with your existing partition layout, you can generate a
basic NixOS configuration for your system using:
```sh
flk up
```
This will make a new file `hosts/up-$(hostname).nix`, which you can edit to
your liking.
You must then add a host to `nixos.hosts` in flake.nix:
```nix
{
nixos.hosts = {
modules = hosts/NixOS.nix;
};
}
```
Make sure your `i18n.defaultLocale` and `time.timeZone` are set properly for
your region. Keep in mind that `networking.hostName` will be automatically
set to the name of your host;
Now might be a good time to read the docs on [suites](../concepts/suites.md) and
[profiles](../concepts/profiles.md) and add or create any that you need.
> ##### _Note:_
> While the `up` sub-command is provided as a convenience to quickly set up and
> install a "fresh" NixOS system on current hardware, committing these files is
> discouraged.
>
> They are placed in the git staging area automatically because they would be
> invisible to the flake otherwise, but it is best to move what you need from
> them directly into a host module of your own making, and commit that instead.
# Installation
Once you're ready to deploy `hosts/my-host.nix`:
```sh
flk my-host switch
```
This calls `nixos-rebuild` with sudo to build and install your configuration.
> ##### _Notes:_
> - Instead of `switch`, you can pass `build`, `test`, `boot`, etc just as with
> `nixos-rebuild`.
>
> - It is convenient to have the template living at `/etc/nixos` so you can
> simply `sudo nixos-rebuild switch` from anywhere on the system, but it is
> not required.

41
doc/start/index.md Normal file
View file

@ -0,0 +1,41 @@
# Quick Start
The only dependency is nix, so make sure you have it [installed][install-nix].
## Get the Template
Here is a snippet that will get you the template without the git history:
```sh
nix-shell -p cachix --run "cachix use nrdxp"
nix-shell https://github.com/divnix/devos/archive/core.tar.gz -A shell \
--run "flk get core"
cd flk
nix-shell
git init
git add .
git commit -m init
```
This will place you in a new folder named `flk` with git initialized, and a
nix-shell that provides all the dependencies, including the unstable nix
version required.
In addition, the [binary cache](../integrations/cachix.md) is added for faster deployment.
> ##### _Notes:_
> - Flakes ignore files that have not been added to git, so be sure to stage new
> files before building the system.
> - You can choose to simply clone the repo with git if you want to follow
> upstream changes.
> - If the `nix-shell -p cachix --run "cachix use nrdxp"` line doesn't work
> you can try with sudo: `sudo nix-shell -p cachix --run "cachix use nrdxp"`
## Next Steps:
- [Make installable ISO](./iso.md)
- [Bootstrap Host](./bootstrapping.md)
- [Already on NixOS](./from-nixos.md)
[install-nix]: https://nixos.org/manual/nix/stable/#sect-multi-user-installation

22
doc/start/iso.md Normal file
View file

@ -0,0 +1,22 @@
# ISO
Making and writing an installable iso for `hosts/bootstrap.nix` is as simple as:
```sh
bud build bootstrap bootstrapIso
sudo -E $(which bud) burn
```
This works for any host.
## ISO image nix store & cache
The iso image holds the store to the live environment and _also_ acts as a binary cache
to the installer. To considerably speed up things, the image already includes all flake
`inputs` as well as the `devshell` closures.
While you _could_ provision any machine with a single stick, a custom-made iso for
the host you want to install DevOS to, maximises those local cache hits.
For hosts that don't differ too much, a single usb stick might be ok, whereas when
there are bigger differences, a custom-made usb stick will be considerably faster.

33
doc/tests.md Normal file
View file

@ -0,0 +1,33 @@
# Testing
Testing is always an important aspect of any software development project, and
NixOS offers some incredibly powerful tools to write tests for your
configuration, and, optionally, run them in
[CI](./integrations/hercules.md).
## Unit Tests
Unit tests can be created from regular derivations, and they can do
almost anything you can imagine. By convention, it is best to test your
packages during their [check phase][check]. All packages and their tests will
be built during CI.
## Integration Tests
All your profiles defined in suites will be tested in a NixOS VM.
You can write integration tests for one or more NixOS VMs that can,
optionally, be networked together, and yes, it's as awesome as it sounds!
Be sure to use the `mkTest` function from digga, `digga.lib.pkgs-lib.mkTest`
which wraps the official [testing-python][testing-python] function to ensure
that the system is setup exactly as it is for a bare DevOS system. There are
already great resources for learning how to use these tests effectively,
including the official [docs][test-doc], a fantastic [blog post][test-blog],
and the examples in [nixpkgs][nixos-tests].
[test-doc]: https://nixos.org/manual/nixos/stable/index.html#sec-nixos-tests
[test-blog]: https://www.haskellforall.com/2020/11/how-to-use-nixos-for-lightweight.html
[default]: https://github.com/divnix/devos/tree/core/tests/default.nix
[run-test]: https://github.com/NixOS/nixpkgs/blob/6571462647d7316aff8b8597ecdf5922547bf365/lib/debug.nix#L154-L166
[nixos-tests]: https://github.com/NixOS/nixpkgs/tree/master/nixos/tests
[testing-python]: https://github.com/NixOS/nixpkgs/tree/master/nixos/lib/testing-python.nix
[check]: https://nixos.org/manual/nixpkgs/stable/#ssec-check-phase

6
doc/theme/highlight.js vendored Normal file

File diff suppressed because one or more lines are too long

1115
flake.lock

File diff suppressed because it is too large Load diff

435
flake.nix
View file

@ -1,275 +1,190 @@
{
description = "Sealight NixOS Config";
description = "A highly structured configuration database.";
inputs = {
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
# ngipkgs.url = "github:Chickensoupwithrice/ngipkgs?ref=aynish/atomic-server-module";
# ngipkgs-local.url = "path:/home/anish/usr/ngipkgs";
# Home manager
home-manager.url = "github:nix-community/home-manager/release-24.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
hardware.url = "github:nixos/nixos-hardware";
# Tools
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
deploy-rs.url = "github:serokell/deploy-rs";
deploy-rs.inputs.nixpkgs.follows = "nixpkgs";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
# My Packages
poonam.url = "git+ssh://gitea@git.sealight.xyz/aynish/kitaab?ref=main";
poonam.inputs.nixpkgs.follows = "nixpkgs";
basant.url = "git+ssh://gitea@git.sealight.xyz/aynish/basant?ref=main";
vimwikicli.url =
"git+ssh://gitea@git.sealight.xyz/aynish/vimwiki-cli?ref=main";
basant.inputs.nixpkgs.follows = "nixpkgs";
basant.inputs.poonam.follows = "poonam";
vimwikicli.inputs.nixpkgs.follows = "nixpkgs";
grasp.url = "git+ssh://gitea@git.sealight.xyz/aynish/grasp.git?ref=main";
grasp.inputs.nixpkgs.follows = "nixpkgs";
# Matrix
nix-matrix-appservices.url = "gitlab:coffeetables/nix-matrix-appservices";
# Others
nur.url = "github:nix-community/NUR";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
inputs =
{
# Nix
nixos.url = "github:nixos/nixpkgs/release-22.11";
latest.url = "github:nixos/nixpkgs/nixos-unstable";
# Community
home.url = "github:nix-community/home-manager/release-22.11";
home.inputs.nixpkgs.follows = "nixos";
nixos-hardware.url = "github:nixos/nixos-hardware";
# Lib
digga.url = "github:divnix/digga";
digga.inputs.nixpkgs.follows = "nixos";
digga.inputs.nixlib.follows = "nixos";
digga.inputs.home-manager.follows = "home";
digga.inputs.deploy.follows = "deploy";
nvfetcher.url = "github:berberman/nvfetcher";
nvfetcher.inputs.nixpkgs.follows = "nixos";
naersk.url = "github:nmattia/naersk";
naersk.inputs.nixpkgs.follows = "nixos";
nur.url = "github:nix-community/NUR";
# Tools
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixos";
deploy.url = "github:serokell/deploy-rs";
deploy.inputs.nixpkgs.follows = "nixos";
# Packages
poonam.url = "git+ssh://gitea@git.sealight.xyz/aynish/kitaab?ref=main";
basant.url = "git+ssh://gitea@git.sealight.xyz/aynish/basant?ref=main";
basant.inputs.nixpkgs.follows = "nixos";
basant.inputs.poonam.follows = "poonam";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixos";
};
eww = {
url = "github:elkowar/eww";
inputs.nixpkgs.follows = "nixos";
inputs.rust-overlay.follows = "rust-overlay";
};
# eww follows rust nightly
# eww.inputs.nixpkgs.follows = "latest";
grasp.url = "git+ssh://gitea@git.sealight.xyz/aynish/grasp.git?ref=main";
grasp.inputs.nixpkgs.follows = "nixos";
tidalcycles.url = "github:mitchmindtree/tidalcycles.nix";
tidalcycles.inputs.nixpkgs.follows = "latest";
neovim-nightly.url = "github:nix-community/neovim-nightly-overlay";
neovim-nightly.inputs.nixpkgs.follows = "nixos";
# TODO hundred rabbits software
# TODO not quite useful yet, since it needs secrets
# dhyan.url = "git+ssh://gitea@git.sealight.xyz/aynish/dhyan?ref=main";
# dhyan.inputs.nixpkgs.follows = "nixos";
# TODO needs secrets
# muneem.url = "git+ssh://gitea@git.sealight.xyz/aynish/muneem?ref=main";
# muneem.inputs.nixpkgs.follows = "nixos";
};
tidalcycles.url = "github:mitchmindtree/tidalcycles.nix";
tidalcycles.inputs.nixpkgs.follows = "unstable";
# TODO hundred rabbits software
# TODO needs secrets
# dhyan.url = "git+ssh://gitea@git.sealight.xyz/aynish/dhyan?ref=main";
# dhyan.inputs.nixpkgs.follows = "nixpkgs";
# TODO needs secrets
# muneem.url = "git+ssh://gitea@git.sealight.xyz/aynish/muneem?ref=main";
# muneem.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, unstable, nixos-hardware, home-manager, deploy-rs
, agenix, disko, basant, grasp, nix-matrix-appservices, nur, tidalcycles
, rust-overlay, vimwikicli, ... }@inputs:
let
forAllSystems = nixpkgs.lib.genAttrs [
"aarch64-linux"
"i686-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
unstableOverlay = final: prev: {
# We already have these in scope
unstable = unstable.legacyPackages.${prev.system};
deploy = deploy-rs.packages.${prev.system}.deploy-rs;
};
vimwikiOverlay = final: prev: {
vimwiki-cli = vimwikicli.packages.${prev.system}.vimwiki-cli;
};
outputs =
{ self
, digga
, nixos
, home
, nixos-hardware
, nur
, agenix
, nvfetcher
, deploy
, basant
, grasp
, tidalcycles
, neovim-nightly
, rust-overlay
, eww
, ...
} @ inputs:
digga.lib.mkFlake
{
inherit self inputs;
supportedSystems = [
"x86_64-linux"
];
nixpkgsFor = forAllSystems (system:
import nixpkgs {
inherit system;
config.allowUnfreePredicate = pkg:
builtins.elem (nixpkgs.lib.getName pkg) [
"ripcord"
"vcv-rack"
"SunVox"
"renoise"
channelsConfig = { allowUnfree = true; };
channels = {
nixos = {
imports = [ (digga.lib.importOverlays ./overlays) ];
overlays = [
nur.overlay
agenix.overlay
nvfetcher.overlay
deploy.overlay
./pkgs/default.nix
tidalcycles.overlays.default
# neovim-nightly.overlay
rust-overlay.overlays.default
eww.overlays.default
];
# config.permittedInsecurePackages = [
# "python3.10-django-3.1.14" # Needed for archivebox deployments on curve
# # Check when archive box updates it's dependeny
# ];
overlays = [
rust-overlay.overlays.default
tidalcycles.overlays.default
agenix.overlays.default
nur.overlay
nix-matrix-appservices.overlay
unstableOverlay
vimwikiOverlay
self.overlays.additions
self.overlays.modifications
];
});
# for when space matters
litePkgsFor = forAllSystems (system:
import nixpkgs {
inherit system;
# config.permittedInsecurePackages = [
# "forgejo-1.19.4-0" # Needed for archivebox deployments on curve
# # Check when archive box updates it's dependeny
# ];
overlays = [
agenix.overlays.default
self.overlays.additions
self.overlays.modifications
tidalcycles.overlays.default # needed for nvim which comes pre-installed lol
];
});
in {
# Your custom packages
# Acessible through 'nix build', 'nix shell', etc
packages = forAllSystems (system:
let pkgs = nixpkgsFor.${system};
in import ./pkgs { pkgs = pkgs; });
# Devshell for bootstrapping
# Acessible through 'nix develop' or 'nix-shell' (legacy)
devShells = forAllSystems (system:
let pkgs = nixpkgsFor.${system};
in import ./shell.nix { pkgs = pkgs; });
# Your custom packages and modifications, exported as overlays
overlays = import ./overlays;
# Reusable nixos modules you might want to export
# These are usually stuff you would upstream into nixpkgs
nixosModules = import ./modules/nixos;
# Reusable home-manager modules you might want to export
# These are usually stuff you would upstream into home-manager
homeManagerModules = import ./modules/home-manager;
# NixOS configuration entrypoint
nixosConfigurations = {
curve = nixpkgs.lib.nixosSystem rec {
specialArgs = { inherit inputs self; };
system = "x86_64-linux";
pkgs = nixpkgsFor.${system};
modules = [
./hosts/curve
agenix.nixosModules.age
self.nixosModules.backup
self.nixosModules.wireguard
self.nixosModules.wallabag
nixos-hardware.nixosModules.lenovo-thinkpad-x270
home-manager.nixosModules.home-manager
{
nix.registry.nixpkgs.flake = nixpkgs;
nix.registry.unstable.flake = unstable;
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.anish = import ./home/gui;
}
];
};
latest = { };
};
helix = nixpkgs.lib.nixosSystem rec {
specialArgs = { inherit inputs self; };
system = "x86_64-linux";
pkgs = litePkgsFor.${system};
modules = [
./hosts/helix
agenix.nixosModules.age
self.nixosModules.backup
self.nixosModules.wireguard
basant.nixosModule
# self.nixosModules.microbin
disko.nixosModules.disko
{
nixpkgs.flake.setNixPath = false;
nixpkgs.flake.setFlakeRegistry = false;
}
];
};
lib = import ./lib { lib = digga.lib // nixos.lib; };
lituus = nixpkgs.lib.nixosSystem rec {
specialArgs = { inherit inputs self; };
system = "x86_64-linux";
pkgs = nixpkgsFor.${system};
modules = [
./hosts/lituus
agenix.nixosModules.age
self.nixosModules.backup
self.nixosModules.hesienbridge
nix-matrix-appservices.nixosModule
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.anish = import ./home/core;
}
];
};
sharedOverlays = [
(final: prev: {
__dontExport = true;
lib = prev.lib.extend (lfinal: lprev: {
our = self.lib;
});
})
];
box = nixpkgs.lib.nixosSystem rec {
specialArgs = { inherit inputs self; };
system = "x86_64-linux";
pkgs = nixpkgsFor.${system};
modules = [
./hosts/box
agenix.nixosModules.age
self.nixosModules.backup
self.nixosModules.wireguard
self.nixosModules.gonic
self.nixosModules.gpodder2go
self.nixosModules.wallabag
self.nixosModules.ulogger-server
grasp.nixosModule
home-manager.nixosModules.home-manager
{
nix.registry.nixpkgs.flake = nixpkgs;
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.anish = import ./home/dev;
}
];
};
};
nixos = {
hostDefaults = {
system = "x86_64-linux";
channelName = "nixos";
imports = [ (digga.lib.importExportableModules ./modules) ];
modules = [
{ lib.our = self.lib; }
digga.nixosModules.nixConfig
home.nixosModules.home-manager
agenix.nixosModules.age
];
};
# Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = {
"anish@work" = home-manager.lib.homeManagerConfiguration {
pkgs =
nixpkgsFor."x86_64-linux"; # Home-manager requires 'pkgs' instance
extraSpecialArgs = { inherit inputs; };
modules = [ ./home/core.nix ./home/profiles/firefox ];
};
};
deploy.nodes = {
box = {
hostname = "mossnet.lan";
autoRollback = false;
magicRollback = false;
remoteBuild = true;
profiles.system = {
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos
self.nixosConfigurations.box;
imports = [ (digga.lib.importHosts ./hosts) ];
hosts = {
/* set host specific properties here */
curve = {
modules = [
]; # nixos-hardware.nixosModules.lenovo-thinkpad
# Yubikey
};
cube = {
modules = [ basant.nixosModule ];
};
box = {
modules = [
grasp.nixosModule
];
};
# helix = { };
# work = { };
};
importables = rec {
profiles = digga.lib.rakeLeaves ./profiles // {
users = digga.lib.rakeLeaves ./users;
};
suites = with profiles; rec {
base = [ core users.root users.anish ];
sealight = [ base server metrics gitea rss-bridge mount-mossnet freshrss ];
lituus = [ base server metrics sealight-website matrix wireguard-server ];
mossnet = [ base server taskd shaarli dns monitoring nfs gonic headphones radicale seafile syncthing dhyan calibre wallabag finance ]; # hpi sync.music muneem
cube = [ base site server ];
graphical = [ base bluetooth music sync.kitaab sync.website sync.cal wifi desktop mimetypes ];
curve = [ graphical secrets syncthing ];
work = [ base ];
};
};
};
lituus = {
hostname = "sealight.xyz";
# autoRollback = false;
profiles.system = {
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos
self.nixosConfigurations.lituus;
};
};
helix = {
hostname = "git.sealight.xyz";
autoRollback = false;
magicRollback = false;
profiles.system = {
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos
self.nixosConfigurations.helix;
};
};
};
checks = builtins.mapAttrs
(system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
};
home = {
imports = [ (digga.lib.importExportableModules ./users/modules) ];
# exportedModules = [ ];
# modules = [ ];
importables = rec {
profiles = digga.lib.rakeLeaves ./users/profiles;
suites = with profiles; rec {
hmBase = [ direnv git nvim cli task ];
gui = [ hmBase firefox desktop email cal ];
work = [ hmBase firefox ];
};
};
users = {
nixos = { suites, ... }: { imports = suites.hmBase; };
# anish = { suites, ... }: { imports = suites.gui; };
anishlakhwara = { suites, ... }: { imports = suites.work; };
}; # digga.lib.importers.rakeLeaves ./users/hm;
};
devshell = ./shell;
homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations;
deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations { };
};
}

View file

@ -0,0 +1,26 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:
{
imports =
[
<nixpkgs/nixos/modules/profiles/qemu-guest.nix>
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{
device = "/dev/disk/by-uuid/3b8b2c4b-835e-4822-8ac8-0effdc8270d6";
fsType = "btrfs";
};
swapDevices = [ ];
nix.maxJobs = lib.mkDefault 1;
}

View file

@ -1,9 +0,0 @@
{ self, pkgs, ... }:
{
imports = [
../profiles/cli
../profiles/direnv
../profiles/git
];
home.stateVersion = "22.05";
}

View file

@ -1,5 +0,0 @@
{ self, pkgs, ... }: {
imports =
[ ../profiles/cli ../profiles/nvim ../profiles/direnv ../profiles/git ];
home.stateVersion = "22.05";
}

View file

@ -1,14 +0,0 @@
{ pkgs, ... }:
{
imports = [
../core
../profiles/nvim
../profiles/firefox
../profiles/desktop
../profiles/email
../profiles/cal
../profiles/sync/kitaab
../profiles/ssh
../profiles/task
];
}

View file

@ -1,62 +0,0 @@
# This is your home-manager configuration file
# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix)
{ inputs, outputs, lib, config, pkgs, ... }: {
# You can import other home-manager modules here
imports = [
# If you want to use modules your own flake exports (from modules/home-manager):
# outputs.homeManagerModules.example
# Or modules exported from other flakes (such as nix-colors):
# inputs.nix-colors.homeManagerModules.default
# You can also split up your configuration and import pieces of it here:
# ./nvim.nix
];
nixpkgs = {
# You can add overlays here
overlays = [
# If you want to use overlays your own flake exports (from overlays dir):
# outputs.overlays.modifications
# outputs.overlays.additions
# Or overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default
# Or define it inline, for example:
# (final: prev: {
# hi = final.hello.overrideAttrs (oldAttrs: {
# patches = [ ./change-hello-to-hi.patch ];
# });
# })
];
# Configure your nixpkgs instance
config = {
# Disable if you don't want unfree packages
allowUnfree = true;
# Workaround for https://github.com/nix-community/home-manager/issues/2942
allowUnfreePredicate = (_: true);
};
};
# TODO: Set your username
home = {
username = "anish";
homeDirectory = "/home/anish/";
};
# Add stuff for your user as you see fit:
# programs.neovim.enable = true;
# home.packages = with pkgs; [ steam ];
# Enable home-manager and git
programs.home-manager.enable = true;
# programs.git.enable = true;
# Nicely reload system units when changing configs
# systemd.user.startServices = "sd-switch";
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
home.stateVersion = "22.05";
}

View file

@ -1,5 +0,0 @@
#!/usr/bin/env bash
working_directory=$(pwd)
vim_directory="${working_directory//\//%}.vim"
trash "$HOME/.local/share/nvim/sessions/${vim_directory}"

View file

@ -1,19 +0,0 @@
`dasht-docsets-intstall`
Bash
Clojure
Docker
Elixir
HTML
JavaScript
Jinja
Lua_5.4
Nginx
OpenGL_4
PostgreSQL
Processing
Python_3
React
Rust
TypeScript
Vim

View file

@ -1,317 +0,0 @@
#!/usr/bin/env bash
# __ _ _ _ _ _ _
# _ __ ___ / _(_) | |__ | |_ _ ___| |_ ___ ___ | |_| |__
# | '__/ _ \| |_| |_____| '_ \| | | | |/ _ \ __/ _ \ / _ \| __| '_ \
# | | | (_) | _| |_____| |_) | | |_| | __/ || (_) | (_) | |_| | | |
# |_| \___/|_| |_| |_.__/|_|\__,_|\___|\__\___/ \___/ \__|_| |_|
#
# Author: Nick Clyde (clydedroid)
#
# A script that generates a rofi menu that uses bluetoothctl to
# connect to bluetooth devices and display status info.
#
# Inspired by networkmanager-dmenu (https://github.com/firecat53/networkmanager-dmenu)
# Thanks to x70b1 (https://github.com/polybar/polybar-scripts/tree/master/polybar-scripts/system-bluetooth-bluetoothctl)
#
# Depends on:
# Arch repositories: rofi, bluez-utils (contains bluetoothctl)
# Constants
divider="---------"
goback="Back"
# Checks if bluetooth controller is powered on
power_on() {
if bluetoothctl show | grep -q "Powered: yes"; then
return 0
else
return 1
fi
}
# Toggles power state
toggle_power() {
if power_on; then
bluetoothctl power off
show_menu
else
if rfkill list bluetooth | grep -q 'blocked: yes'; then
rfkill unblock bluetooth && sleep 3
fi
bluetoothctl power on
show_menu
fi
}
# Checks if controller is scanning for new devices
scan_on() {
if bluetoothctl show | grep -q "Discovering: yes"; then
echo "Scan: on"
return 0
else
echo "Scan: off"
return 1
fi
}
# Toggles scanning state
toggle_scan() {
if scan_on; then
kill $(pgrep -f "bluetoothctl scan on")
bluetoothctl scan off
show_menu
else
bluetoothctl scan on &
echo "Scanning..."
sleep 5
show_menu
fi
}
# Checks if controller is able to pair to devices
pairable_on() {
if bluetoothctl show | grep -q "Pairable: yes"; then
echo "Pairable: on"
return 0
else
echo "Pairable: off"
return 1
fi
}
# Toggles pairable state
toggle_pairable() {
if pairable_on; then
bluetoothctl pairable off
show_menu
else
bluetoothctl pairable on
show_menu
fi
}
# Checks if controller is discoverable by other devices
discoverable_on() {
if bluetoothctl show | grep -q "Discoverable: yes"; then
echo "Discoverable: on"
return 0
else
echo "Discoverable: off"
return 1
fi
}
# Toggles discoverable state
toggle_discoverable() {
if discoverable_on; then
bluetoothctl discoverable off
show_menu
else
bluetoothctl discoverable on
show_menu
fi
}
# Checks if a device is connected
device_connected() {
device_info=$(bluetoothctl info "$1")
if echo "$device_info" | grep -q "Connected: yes"; then
return 0
else
return 1
fi
}
# Toggles device connection
toggle_connection() {
if device_connected $1; then
bluetoothctl disconnect $1
device_menu "$device"
else
bluetoothctl connect $1
device_menu "$device"
fi
}
# Checks if a device is paired
device_paired() {
device_info=$(bluetoothctl info "$1")
if echo "$device_info" | grep -q "Paired: yes"; then
echo "Paired: yes"
return 0
else
echo "Paired: no"
return 1
fi
}
# Toggles device paired state
toggle_paired() {
if device_paired $1; then
bluetoothctl remove $1
device_menu "$device"
else
bluetoothctl pair $1
device_menu "$device"
fi
}
# Checks if a device is trusted
device_trusted() {
device_info=$(bluetoothctl info "$1")
if echo "$device_info" | grep -q "Trusted: yes"; then
echo "Trusted: yes"
return 0
else
echo "Trusted: no"
return 1
fi
}
# Toggles device connection
toggle_trust() {
if device_trusted $1; then
bluetoothctl untrust $1
device_menu "$device"
else
bluetoothctl trust $1
device_menu "$device"
fi
}
# Prints a short string with the current bluetooth status
# Useful for status bars like polybar, etc.
print_status() {
if power_on; then
printf ''
paired_devices_cmd="devices Paired"
# Check if an outdated version of bluetoothctl is used to preserve backwards compatibility
if (( $(echo "$(bluetoothctl version | cut -d ' ' -f 2) < 5.65" | bc -l) )); then
paired_devices_cmd="paired-devices"
fi
mapfile -t paired_devices < <(bluetoothctl $paired_devices_cmd | grep Device | cut -d ' ' -f 2)
counter=0
for device in "${paired_devices[@]}"; do
if device_connected $device; then
device_alias=$(bluetoothctl info $device | grep "Alias" | cut -d ' ' -f 2-)
if [ $counter -gt 0 ]; then
printf ", %s" "$device_alias"
else
printf " %s" "$device_alias"
fi
((counter++))
fi
done
printf "\n"
else
echo ""
fi
}
# A submenu for a specific device that allows connecting, pairing, and trusting
device_menu() {
device=$1
# Get device name and mac address
device_name=$(echo $device | cut -d ' ' -f 3-)
mac=$(echo $device | cut -d ' ' -f 2)
# Build options
if device_connected $mac; then
connected="Connected: yes"
else
connected="Connected: no"
fi
paired=$(device_paired $mac)
trusted=$(device_trusted $mac)
options="$connected\n$paired\n$trusted\n$divider\n$goback\nExit"
# Open rofi menu, read chosen option
chosen="$(echo -e "$options" | $rofi_command "$device_name")"
# Match chosen option to command
case $chosen in
"" | $divider)
echo "No option chosen."
;;
$connected)
toggle_connection $mac
;;
$paired)
toggle_paired $mac
;;
$trusted)
toggle_trust $mac
;;
$goback)
show_menu
;;
esac
}
# Opens a rofi menu with current bluetooth status and options to connect
show_menu() {
# Get menu options
if power_on; then
power="Power: on"
# Human-readable names of devices, one per line
# If scan is off, will only list paired devices
devices=$(bluetoothctl devices | grep Device | cut -d ' ' -f 3-)
# Get controller flags
scan=$(scan_on)
pairable=$(pairable_on)
discoverable=$(discoverable_on)
# Options passed to rofi
options="$devices\n$divider\n$power\n$scan\n$pairable\n$discoverable\nExit"
else
power="Power: off"
options="$power\nExit"
fi
# Open rofi menu, read chosen option
chosen="$(echo -e "$options" | $rofi_command "Bluetooth")"
# Match chosen option to command
case $chosen in
"" | $divider)
echo "No option chosen."
;;
$power)
toggle_power
;;
$scan)
toggle_scan
;;
$discoverable)
toggle_discoverable
;;
$pairable)
toggle_pairable
;;
*)
device=$(bluetoothctl devices | grep "$chosen")
# Open a submenu if a device is selected
if [[ $device ]]; then device_menu "$device"; fi
;;
esac
}
# Rofi command to pipe into, can add any options here
rofi_command="rofi -theme theme/passmenu.rasi -dmenu -no-fixed-num-lines -yoffset -100 -i -p"
case "$1" in
--status)
print_status
;;
*)
show_menu
;;
esac

View file

@ -1,71 +0,0 @@
#!/bin/sh
# Get class of a wid
get_class() {
id=$1
if [ -z "$id" ]; then
echo ""
else
xprop -id "$id" | sed -n \
-e '/WM_CLASS/s/\( "\)/\n/g; s/[^\n]*\n\([^"]*\)[^\n]*/\1\n/g' \
-e '/WM_COMMAND/s/[^"]*/\n\n/1; s/\n"//1; s/\n\([^"]*\)".*/\n\1/; /\n/p' | sed '/^$/d' | head -n1
fi
}
get_pid() {
xprop _NET_WM_PID -id "$1" | awk '/[0-9]+/ {print $3}'
}
get_ppid() {
ps -o ppid= -p $1
}
check_swallowing_process() {
pid=$(get_pid $1)
[ -z $pid ] && return 0
gppid=$(get_ppid $(get_ppid $pid))
grep -i "^$(ps -o cmd= -p $gppid | awk '{print $1}' | sed 's_^.*/__')$" ~/.config/bspwm/terminals && return 0
[ "$(get_ppid "$(get_ppid "$(get_pid "$1")")")" = "$(get_pid "$2")" ] && return 0 || return 1
}
swallow() {
addedtodesktop=$2
lasttermdesktop=$(bspc query -D -n last)
swallowerid=$1
swallowingid=$(bspc query -N -n last)
if [ "$addedtodesktop" = "$lasttermdesktop" ] && check_swallowing_process "$swallowerid" "$swallowingid"; then
grep -q "^$(get_class "$swallowerid")$" ~/.config/bspwm/{noswallow, terminals} && return
grep -i "^$(get_class "$swallowingid")$" ~/.config/bspwm/terminals || return
echo "$swallowerid $swallowingid" >> /tmp/swallowids
bspc node "$swallowingid" --flag hidden=on
fi
}
spit() {
spitterid=$1
spitterdesktop=$2
grep "^$spitterid" /tmp/swallowids || return
spittingid=$(grep "^$spitterid" /tmp/swallowids | head -n1 | awk '{print $2}')
bspc node "$spittingid" --flag hidden=off
termdesktop=$(bspc query -D -n "$spittingid")
[ "$termdesktop" = "$spitterdesktop" ] || bspc node "$spittingid" -d "$spitterdesktop"
bspc node "$spittingid" -f
sed -i "/^$spitterid/d" /tmp/swallowids
}
bspc subscribe node_add node_remove | while read -r event
do
case $(echo "$event" | awk '{ print $1 }') in
node_add)
swallow $(echo "$event" | awk '{print $5 " " $3}')
;;
node_remove)
spit $(echo "$event" | awk '{print $4 " " $3}')
;;
esac
done

View file

@ -1,15 +0,0 @@
#!/usr/bin/env bash
# get into a shell that has poonam
cd ~/kitaab || exit;
nix develop;
# Use fzf to select a file and capture the output
selected_file=$(${pkgs.poonam}/main report --titles=false | head -n -2 | fzf --preview 'bat --color=always --terminal-width -1 ./vimwiki/{}')
echo $selected_file
# Add additional details to the file path
# file_path="./vimwiki/${selected_file}"
#
# # Open the file in vim for editing
# vim "${file_path}"
#

View file

@ -1 +0,0 @@
curl -F "content=$(xclip -o)" -X POST https://bin.sealight.xyz/upload

View file

@ -1,115 +0,0 @@
#!/usr/bin/env bash
# rofi config without entry so to make select from available options only
rofiprompt=theme/passmenu.rasi
# normal rofi menu
rofidmenu=theme/passmenu.rasi
# rofi config for password
rofipass=theme/passmenu.rasi
# Power Status
flag=$(cat /sys/class/net/wl*/flags)
if [ "$flag" = "0x1003" ]; then
power="On"
else
power="Off"
fi
# Connection Status
state=$(cat /sys/class/net/wl*/operstate)
if [ "$state" = "up" ]; then
status=$(nmcli | grep "^wlp" | sed 's/\ connected\ to/Connected to/' | cut -d ':' -f2)
else
status="Disconnected"
fi
# ┌─┐┌─┐┬ ┬┌─┐┬─┐
# ├─┘│ ││││├┤ ├┬┘
# ┴ └─┘└┴┘└─┘┴└─
powertoggle=$( [ "$flag" = "0x1003" ] && echo "Power Off" || echo "Power On" )
powerswitch() {
if [ "$powertoggle" = "Power Off" ]; then
nmcli radio wifi off
elif [ "$powertoggle" = "Power On" ]; then
nmcli radio wifi on
fi
}
# ┌─┐┌─┐┌┐┌┌┐┌┌─┐┌─┐┌┬┐
# │ │ │││││││├┤ │ │
# └─┘└─┘┘└┘┘└┘└─┘└─┘ ┴
connections() {
list=$(nmcli --fields "SECURITY,SSID" device wifi list | tail -n +2 | sed "s/ */ /g" | sed -E "s/WPA*.?//g" | sed "s/^--//g" | sed "s/ //g")
networks=$(printf "$list" | rofi -theme $rofiprompt -dmenu -i -hover-select -p "Select Wifi Network
$status")
wifi=$( echo "$networks" | sed "s/ //g" | sed "s/ //g" | xargs)
[ -z "$networks" ] && exit
nopass="No Password"
pass=$(printf "$nopass\nCancel" | rofi -theme $rofipass -dmenu -i -hover-select -password -p "Wifi Password")
if [ "$pass" = "" ]; then
exit
elif [ "$pass" = "$nopass" ]; then
nmcli dev wifi con "$wifi" && printf "exit" | rofi -theme $rofiprompt -dmenu -only-match -i -p "Successfully Connected to $wifi" && exit
elif [ "$pass" = "Cancel" ]; then
exit
else
nmcli dev wifi con "$wifi" password "$pass" && printf "exit" | rofi -theme $rofiprompt -dmenu -i -only-match -p "Successfully Connected to $wifi" && exit
fi
printf "exit" | rofi -theme $rofiprompt -dmenu -i -p -only-match "Failed to Connect $wifi" && exit
}
# ┌┬┐┌─┐┌┐┌┬ ┬┌─┐┬
# │││├─┤││││ │├─┤│
# ┴ ┴┴ ┴┘└┘└─┘┴ ┴┴─┘
manual() {
wifi=$(rofi -theme $rofidmenu -dmenu -i -p "Enter Wifi Name")
[ -z "$wifi" ] && exit
nopass="Run Without Password"
pass=$(printf "$nopass\nCancel" | rofi -theme $rofipass -dmenu -i -password -p "Wifi Password")
if [ "$pass" = "" ]; then
exit
elif [ "$pass" = "$nopass" ]; then
nmcli dev wifi con "$wifi" && printf "exit" | rofi -theme $rofiprompt -dmenu -i -only-match -p "Successfully Connected to $wifi" && exit
elif [ "$pass" = "Cancel" ]; then
exit
else
nmcli dev wifi con "$wifi" password "$pass" && printf "exit" | rofi -theme $rofiprompt -dmenu -i -only-match -p "Successfully Connected to $wifi" && exit
fi
printf "exit" | rofi -theme $rofiprompt -dmenu -only-match -i -p "Failed to Connect $wifi" && exit
}
# ┌─┐┌─┐┌┬┐┬┌─┐┌┐┌┌─┐
# │ │├─┘ │ ││ ││││└─┐
# └─┘┴ ┴ ┴└─┘┘└┘└─┘
options="$powertoggle\nConnections\nConnect Manually"
rofiwifi=$(printf "$options" | rofi -theme $rofiprompt -dmenu -i -hover-select -p "Wifi
Powered: $power
Status: $status")
case $rofiwifi in
$powertoggle)
powerswitch
;;
Connections)
notify-send "Scanning"
connections
;;
"Connect Manually")
manual
esac 2>/dev/null

View file

@ -1,443 +0,0 @@
# vim: ft=cfg
# See dunst(5) for all configuration options
[global]
### Display ###
# Which monitor should the notifications be displayed on.
monitor = 0
# Display notification on focused monitor. Possible modes are:
# mouse: follow mouse pointer
# keyboard: follow window with keyboard focus
# none: don't follow anything
#
# "keyboard" needs a window manager that exports the
# _NET_ACTIVE_WINDOW property.
# This should be the case for almost all modern window managers.
#
# If this option is set to mouse or keyboard, the monitor option
# will be ignored.
follow = none
### Geometry ###
# dynamic width from 0 to 300
# width = (0, 300)
# constant width of 300
width = (160, 320)
# The maximum height of a single notification, excluding the frame.
height = 400
# Position the notification in the top right corner
origin = top-right
# Offset from the origin
offset = 12x36
# Scale factor. It is auto-detected if value is 0.
scale = 0
# Maximum number of notification (0 means no limit)
notification_limit = 5
### Progress bar ###
# Turn on the progess bar. It appears when a progress hint is passed with
# for example dunstify -h int:value:12
progress_bar = true
# Set the progress bar height. This includes the frame, so make sure
# it's at least twice as big as the frame width.
progress_bar_height = 2
# Set the frame width of the progress bar
progress_bar_frame_width = 0
# Set the minimum width for the progress bar
progress_bar_min_width = 160
# Set the maximum width for the progress bar
progress_bar_max_width = 320
# Show how many messages are currently hidden (because of
# notification_limit).
indicate_hidden = yes
# The transparency of the window. Range: [0; 100].
# This option will only work if a compositing window manager is
# present (e.g. xcompmgr, compiz, etc.). (X11 only)
transparency = 0
# Draw a line of "separator_height" pixel height between two
# notifications.
# Set to 0 to disable.
separator_height = 1
# Padding between text and separator.
padding = 8
# Horizontal padding.
horizontal_padding = 8
# Padding between text and icon.
text_icon_padding = 8
# Defines width in pixels of frame around the notification window.
# Set to 0 to disable.
frame_width = 1
# Defines color of the frame around the notification window.
frame_color = "#414868"
# Define a color for the separator.
# possible values are:
# * auto: dunst tries to find a color fitting to the background;
# * foreground: use the same color as the foreground;
# * frame: use the same color as the frame;
# * anything else will be interpreted as a X color.
separator_color = frame
# Sort messages by urgency.
sort = yes
# Don't remove messages, if the user is idle (no mouse or keyboard input)
# for longer than idle_threshold seconds.
# Set to 0 to disable.
# A client can set the 'transient' hint to bypass this. See the rules
# section for how to disable this if necessary
# idle_threshold = 120
### Text ###
font = Iosevka Nerd Font 10
# The spacing between lines. If the height is smaller than the
# font height, it will get raised to the font height.
line_height = 0
# Possible values are:
# full: Allow a small subset of html markup in notifications:
# <b>bold</b>
# <i>italic</i>
# <s>strikethrough</s>
# <u>underline</u>
#
# For a complete reference see
# <https://docs.gtk.org/Pango/pango_markup.html>.
#
# strip: This setting is provided for compatibility with some broken
# clients that send markup even though it's not enabled on the
# server. Dunst will try to strip the markup but the parsing is
# simplistic so using this option outside of matching rules for
# specific applications *IS GREATLY DISCOURAGED*.
#
# no: Disable markup parsing, incoming notifications will be treated as
# plain text. Dunst will not advertise that it has the body-markup
# capability if this is set as a global setting.
#
# It's important to note that markup inside the format option will be parsed
# regardless of what this is set to.
markup = full
# The format of the message. Possible variables are:
# %a appname
# %s summary
# %b body
# %i iconname (including its path)
# %I iconname (without its path)
# %p progress value if set ([ 0%] to [100%]) or nothing
# %n progress value if set without any extra characters
# %% Literal %
# Markup is allowed
format = "<b>%s</b>\n%b"
# Alignment of message text.
# Possible values are "left", "center" and "right".
alignment = left
# Vertical alignment of message text and icon.
# Possible values are "top", "center" and "bottom".
vertical_alignment = top
# Show age of message if message is older than show_age_threshold
# seconds.
# Set to -1 to disable.
show_age_threshold = -1
# Specify where to make an ellipsis in long lines.
# Possible values are "start", "middle" and "end".
ellipsize = end
# Ignore newlines '\n' in notifications.
ignore_newline = no
# Stack together notifications with the same content
stack_duplicates = true
# Hide the count of stacked notifications with the same content
hide_duplicate_count = true
# Display indicators for URLs (U) and actions (A).
show_indicators = no
### Icons ###
# Align icons left/right/off
icon_position = left
# Scale small icons up to this size, set to 0 to disable. Helpful
# for e.g. small files or high-dpi screens. In case of conflict,
# max_icon_size takes precedence over this.
min_icon_size = 0
# Scale larger icons down to this size, set to 0 to disable
max_icon_size = 160
# Paths to default icons.
icon_path = /usr/share/icons/kora/status/symbolic/:/usr/share/icons/kora/status/scalable/:/usr/share/icons/kora/apps/scalable/:/usr/share/icons/kora/mimes/scalable/:/usr/share/icons/kora/devices/scalable:/usr/share/icons/kora/places/scalable
### History ###
# Should a notification popped up from history be sticky or timeout
# as if it would normally do.
sticky_history = no
# Maximum amount of notifications kept in history
history_length = 8
### Misc/Advanced ###
# dmenu path.
dmenu = /usr/bin/dmenu -p dunst
# Browser for opening urls in context menu.
browser = /usr/bin/xdg-open
# Always run rule-defined scripts, even if the notification is suppressed
always_run_script = true
# Define the title of the windows spawned by dunst
title = dunst
# Define the class of the windows spawned by dunst
class = dunst
# Define the corner radius of the notification window
# in pixel size. If the radius is 0, you have no rounded
# corners.
# The radius will be automatically lowered if it exceeds half of the
# notification height to avoid clipping text and/or icons.
corner_radius = 0
# Ignore the dbus closeNotification message.
# Useful to enforce the timeout set by dunst configuration. Without this
# parameter, an application may close the notification sent before the
# user defined timeout.
ignore_dbusclose = false
### Wayland ###
# These settings are Wayland-specific. They have no effect when using X11
# Uncomment this if you want to let notications appear under fullscreen
# applications (default: overlay)
# layer = top
# Set this to true to use X11 output on Wayland.
force_xwayland = false
### Legacy
# Use the Xinerama extension instead of RandR for multi-monitor support.
# This setting is provided for compatibility with older nVidia drivers that
# do not support RandR and using it on systems that support RandR is highly
# discouraged.
#
# By enabling this setting dunst will not be able to detect when a monitor
# is connected or disconnected which might break follow mode if the screen
# layout changes.
force_xinerama = false
### mouse
# Defines list of actions for each mouse event
# Possible values are:
# * none: Don't do anything.
# * do_action: Invoke the action determined by the action_name rule. If there is no
# such action, open the context menu.
# * open_url: If the notification has exactly one url, open it. If there are multiple
# ones, open the context menu.
# * close_current: Close current notification.
# * close_all: Close all notifications.
# * context: Open context menu for the notification.
# * context_all: Open context menu for all notifications.
# These values can be strung together for each mouse event, and
# will be executed in sequence.
mouse_left_click = do_action
mouse_middle_click = close_current
mouse_right_click = context
# Experimental features that may or may not work correctly. Do not expect them
# to have a consistent behaviour across releases.
[experimental]
# Calculate the dpi to use on a per-monitor basis.
# If this setting is enabled the Xft.dpi value will be ignored and instead
# dunst will attempt to calculate an appropriate dpi value for each monitor
# using the resolution and physical size. This might be useful in setups
# where there are multiple screens with very different dpi values.
per_monitor_dpi = false
[urgency_low]
# IMPORTANT: colors have to be defined in quotation marks.
# Otherwise the "#" and following would be interpreted as a comment.
background = "#24283b"
foreground = "#c0caf5"
highlight = "#bb9af7"
timeout = 3
# Icon for notifications with low urgency, uncomment to enable
icon = /dev/null
[urgency_normal]
background = "#24283b"
foreground = "#a9b1d6"
highlight = "#bb9af7"
timeout = 5
# Icon for notifications with normal urgency, uncomment to enable
icon = /dev/null
[urgency_critical]
background = "#24283b"
foreground = "#c0caf5"
frame_color = "#e9af68"
highlight = "#bb9af7"
timeout = 5
# Icon for notifications with critical urgency, uncomment to enable
#icon = /path/to/icon
# Every section that isn't one of the above is interpreted as a rules to
# override settings for certain messages.
#
# Messages can be matched by
# appname (discouraged, see desktop_entry)
# body
# category
# desktop_entry
# icon
# match_transient
# msg_urgency
# stack_tag
# summary
#
# and you can override the
# background
# foreground
# format
# frame_color
# fullscreen
# new_icon
# set_stack_tag
# set_transient
# set_category
# timeout
# urgency
# skip_display
# history_ignore
# action_name
# word_wrap
# ellipsize
# alignment
#
# Shell-like globbing will get expanded.
#
# Instead of the appname filter, it's recommended to use the desktop_entry filter.
# GLib based applications export their desktop-entry name. In comparison to the appname,
# the desktop-entry won't get localized.
#
# SCRIPTING
# You can specify a script that gets run when the rule matches by
# setting the "script" option.
# The script will be called as follows:
# script appname summary body icon urgency
# where urgency can be "LOW", "NORMAL" or "CRITICAL".
#
# NOTE: It might be helpful to run dunst -print in a terminal in order
# to find fitting options for rules.
# Disable the transient hint so that idle_threshold cannot be bypassed from the
# client
#[transient_disable]
# match_transient = yes
# set_transient = no
#
# Make the handling of transient notifications more strict by making them not
# be placed in history.
#[transient_history_ignore]
# match_transient = yes
# history_ignore = yes
# fullscreen values
# show: show the notifications, regardless if there is a fullscreen window opened
# delay: displays the new notification, if there is no fullscreen window active
# If the notification is already drawn, it won't get undrawn.
# pushback: same as delay, but when switching into fullscreen, the notification will get
# withdrawn from screen again and will get delayed like a new notification
#[fullscreen_delay_everything]
# fullscreen = delay
#[fullscreen_show_critical]
# msg_urgency = critical
# fullscreen = show
#[espeak]
# summary = "*"
# script = dunst_espeak.sh
#[script-test]
# summary = "*script*"
# script = dunst_test.sh
#[ignore]
# # This notification will not be displayed
# summary = "foobar"
# skip_display = true
#[history-ignore]
# # This notification will not be saved in history
# summary = "foobar"
# history_ignore = yes
#[skip-display]
# # This notification will not be displayed, but will be included in the history
# summary = "foobar"
# skip_display = yes
#[signed_on]
# appname = Pidgin
# summary = "*signed on*"
# urgency = low
#
#[signed_off]
# appname = Pidgin
# summary = *signed off*
# urgency = low
#
#[says]
# appname = Pidgin
# summary = *says*
# urgency = critical
#
#[twitter]
# appname = Pidgin
# summary = *twitter.com*
# urgency = normal
#
#[stack-volumes]
# appname = "some_volume_notifiers"
# set_stack_tag = "volume"
#
#[play_sound]
# summary = "*"
# script = ~/.local/share/sounds/notify_sound

View file

@ -1 +0,0 @@
{"boxes":["Inbox"],"host":"imap.fastmail.com","onNewMail":"/nix/store/pmvvqwrsyv6ah0x8c82hgkddas5f9ajb-isync-1.4.4/bin/mbsync anish && /nix/store/wyi8a02kk3vh5y7qhdkfzyibb1yl0xc1-notmuch-0.37/bin/notmuch index","onNewMailPost":{"mail":"/nix/store/q360zpybna4djr4kjhjg6hmkk3vj7pjf-libnotify-0.8.1/bin/notify-send -a mail 'email: new in %s'"},"passwordCmd":"'/nix/store/a7gvj343m05j2s32xcnwr35v31ynlypr-coreutils-9.1/bin/cat' '/run/agenix/fastmail'","port":993,"tls":true,"username":"anish@lakhwara.com"}

View file

@ -1,9 +0,0 @@
{
"console.log": {
"prefix": "clog",
"body": [
"console.log('$1')"
],
"description": "Log output to console"
}
}

View file

@ -1,10 +0,0 @@
{
home.file.".ssh/config".text = ''
Host mossnet.lan
ForwardAgent Yes
Host sealight.xyz
ForwardAgent Yes
Host git.sealight.xyz
ForwardAgent Yes
'';
}

View file

@ -1,39 +0,0 @@
{ pkgs, ... }:
let
name = "kitaab-sync";
# Note this will fail if index.wiki is open in vim while this runs
mkStartScript = name: pkgs.writeShellScript "${name}.sh" ''
# set -euo pipefail # Sometimes vimwiki is open and that causes `vimwiki tags rebuild` to fail, we still want to push to git in those cases
PATH=/run/current-system/sw/bin:/etc/profiles/per-user/anish/bin:$PATH
cd /home/anish/kitaab/vimwiki
vimwiki tags rebuild
cd ..
pushd kalpana/
${pkgs.luaPackages.fennel}/bin/fennel main.fnl build
popd
pushd vimwiki/
git add -A .
popd
git diff-index --quiet HEAD || git commit -m 'syncing kitaab' # if nothing, don't exit 1
git push
exit 0
'';
in
{
systemd.user.services.kitaab-sync = {
Service = {
ExecStart = "${mkStartScript name}";
Path = [ pkgs.luaPackages.fennel ];
};
};
systemd.user.timers.kitaab-sync = {
Install = {
WantedBy = [ "timers.target" ];
PartOf = [ "kitaab-sync.service" ];
};
Timer = {
OnCalendar = [ "hourly" ];
};
};
}

View file

@ -1,3 +0,0 @@
#!/usr/bin/env bash
task rc.bulk=0 rc.confirmation=off rc.dependency.confirmation=off rc.recurrence.confirmation=off "$@" modify -idea +backlog

View file

@ -1,3 +0,0 @@
#!/usr/bin/env bash
task rc.bulk=0 rc.confirmation=off rc.dependency.confirmation=off rc.recurrence.confirmation=off "$@" modify -idea -backlog

View file

@ -1,3 +0,0 @@
#!/usr/bin/env bash
task rc.bulk=0 rc.confirmation=off rc.dependency.confirmation=off rc.recurrence.confirmation=off "$@" modify +idea -backlog

View file

@ -1,29 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIE/zCCAuegAwIBAgIUTLEuHYBh/sST/IrIhs+pWjDjW3UwDQYJKoZIhvcNAQEM
BQAwFjEUMBIGA1UEAxMLMTkyLjE2OC4xLjYwIBcNMjEwMjEzMDUzODUxWhgPOTk5
OTEyMzEyMzU5NTlaMBYxFDASBgNVBAMTCzE5Mi4xNjguMS42MIICIjANBgkqhkiG
9w0BAQEFAAOCAg8AMIICCgKCAgEA8ZyNGBoudva5KAe1F281Fe3u91whLPB7SWv4
zvN6n81NaMtl+rkfcO5GrYSbtemeQUz04N9dUIRABPyHGO+y0gQn/1p1KMdFzhH1
wDR45h/Eo7+U+2Y/qjyvdjNU9aPe5yymuqSm0cTdFbRkXBoZDSDrwA0U078oYCBo
yDxubKK7H7jWlSVyaBmsWDA72qdZhcOGKy6YoIEiT18V/57wTXBacBZvs3ORbOR6
SMPjq0Pr32+kDriRbb9lQ9TAAGLE51hM8IBMnAZVvgS5GQ1y8elH4WJc7caom5B3
l1MVQKEtgxU+QA4ZqGr9y7H4ey4Xf0V9pvrnsUTu1zCz+P4wd8jS6toxCnn8A8Tq
c3ytA7t3o7BntLSWeQV5LKEiXqF3n3njqXk5Z0ZxDkI+FkhbnOytwGvUEpanTS1d
z3EyZA8h1huoDdTmL1hVrg9pIaFJG5S9GuwcJiFPFo0QN6lcbhJmKrCOzPKb8Kwn
zhymN7vtskSeqPZnQX+/tGupMzeITwcudoBg7zRUNKikIsTwFze+QV+puGFCjH+B
BIe0NQ+rzpWOyI7FDYIMb5q+/PJKTkH2Bu5qYhgebzdCxKcJGBNoWsgzvl+tofQw
XchzIqR35xbkmvLeuIIABd8BKaowrAUGrRxtp7IZqxcR3XxH1RIimkHzeRHTphU2
oycB3eMCAwEAAaNDMEEwDwYDVR0TAQH/BAUwAwEB/zAPBgNVHQ8BAf8EBQMDBwQA
MB0GA1UdDgQWBBQBl2OoCoAweUqsfVQNmL9H3jtl2DANBgkqhkiG9w0BAQwFAAOC
AgEAypV1zutIu7an9tansll20LH2WMAHqi5JrALPBCO9yTqnCS3xZg8VZott/qxm
/SsdlhKtekpvljiQhKqB4wROTf26GjxB9iAzdfxAZEcpYWkyXQ6qzDpjIHLLB3X2
31KHbMc63GOI4wmpGY532tt3qDb+VhgfK25GyvUvvw5qvFsYeGHdSD/HIEJHKlOK
8esaF2/r+wuOWABbbmSBaCtR8H8T4Z/B5l6PoVft9uu8IQbtuhiDn08mZHat8tUq
nxm3O1JsV4ZNtvqh5st1Qn32f7buM6AFMhMy9bcXwR33TJBuv994zRjJQYk+FKzE
UzrWl9mlglWV34P0+xMxpDFEgQvkJAFmdhcVsZlDwILWzEa/ZrS2EQGsEuzHbfFo
oVQuXjzQkX504kAypwQBwbqPfwwYEev7EPVOj32/ke1TzBLaqqJ5AMABShOUJD3L
pNOWMD3B23lRDll2f/Tkhqq4qriqWmtn7urC5ga6AlnAUueiORHTTcA9XBuAz68q
dVfU3cIwwnGhDAYUB27yeb0mhPGnTz2Xr4tn8TLrL7c0tXZPjDCttr6hUnB+X/Yx
tBxT1fJMZR7lzRMvnLJJQKC5rVKE4AAy+FJb3JvhQw01CF4odCmgWT3y+MG4RxnN
sqTWkKoE6bRT9rnRAG8EntRycibGKH0b1PhpY8ngOgMbfCw=
-----END CERTIFICATE-----

View file

@ -1,19 +0,0 @@
{ pkgs, config, lib, ... }:
{
home.file = {
# Because the below is inconsistent, I turn it off once I have a copy in place.
".taskrc".enable = true;
# WARN ugly hack
# taskwarrior needs write access to this file for centexts
# this way, we get a copy of the file, and we make sure it's writable
".taskrc".source = ./taskrc;
# ".taskrc".executable = true;
# ".taskrc".onChange = "cp ~/.taskrc ~/.taskrc2;rm ~/.taskrc;mv ~/.taskrc2 ~/.taskrc;chmod +w ~/.taskrc";
".task/keys/ca.cert".source = ./ca.cert;
".task/keys/public.cert".source = ./public.cert;
".local/bin/task-note".source = ./bin/task-note.py;
".local/bin/set-idea".source = ./bin/set-idea.sh;
};
}

View file

@ -1,31 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIFRDCCAyygAwIBAgIUCsfV17Ag4utaNHY9sv6x7g/Z3bgwDQYJKoZIhvcNAQEM
BQAwFjEUMBIGA1UEAxMLMTkyLjE2OC4xLjYwIBcNMjEwMjEzMDUzODU0WhgPOTk5
OTEyMzEyMzU5NTlaMCgxFDASBgNVBAMTCzE5Mi4xNjguMS42MRAwDgYDVQQKEwdt
b3NzbmV0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA23j6Xo+BlPpM
APbncIztaYOfL02lvCOhbx5sxPk6TH5dIxzkBAc3T9X6uY+hTY36QT+SjN5z0EBi
UghxwMM8r2G4ip3XLEFgyFDuDzVgRRuGBbSGtOEIqt49lvmBEWKaxDdYftdlDpKq
qV8NlQJJnBJ9cNZlWzlheRALHMvCUsfnX60piWbQjYrq6j+lF9VjUKUClD92/jhS
LaeaQ6vMlCabYNOf+vq8J3L2oRwHkLMPHBa/a5vNT3bL8Q/Sjuegi+zD68k/fobt
Y7gYL/qyhrFfIvGyN0Jf92DTKdj+1ma3kIaG+REeAx5W8NtRdfnSlS+DA5O0mp0P
oMZICs0Xbq474XYkhBoz7smWA4DLT86on7qcCo24CvII9YU0VDYHNtnDi8CaStea
dvGFDiQS5X3Awwsgt5OWJSgBx+NL9piiZq9Eu5E3CGpoYNiTCANrRV21qmyf090h
md01QUU/f1IMa+wBgryTW94OUhSMmknB9roFAmQaD9Xnj6ecGJkq2ZiytpJ37QiV
8h2ZM9K1PUD4/QulCG/U4IG1II7ef1IUyEFpj6BB7CGCHq+qJ7QKT6Kc/quEewHB
eUjG+FvSmCCgfVf/hqYvul7ybbiqMgCSTSziKF7tN8DuFfIZo9EGdckKXxBgQ7ua
BRVnSZw2vh8nJ8jtGkrw/grKwHL/yA0CAwEAAaN2MHQwDAYDVR0TAQH/BAIwADAT
BgNVHSUEDDAKBggrBgEFBQcDAjAPBgNVHQ8BAf8EBQMDB6AAMB0GA1UdDgQWBBQi
MnF9Np64W1zshqQxe8Cgvm8hFDAfBgNVHSMEGDAWgBQBl2OoCoAweUqsfVQNmL9H
3jtl2DANBgkqhkiG9w0BAQwFAAOCAgEAsNqR/SziOtCRS+n7FGxJ+3FpfACqV4Yl
MDTbpRe0qUcbMDetWZALdPS5gNW/4rj2cpacd3eQI6qRLtUW/l8QGqZl8OjslA2X
/N+9Alza8D+cv6Almx1TclcYJF/Z0NneJ4DgdFXJAPK3zf5eD73N/7EohNWy70Bj
J/4cmYL3T1Pq/FhN/9DV9HoSaRxy9naRjZ3dZXC4CgFRExXw+sEHLDzOHrLDz2xN
4qOjYUH3I1rGWXsSGRFztgNTnA02hPxG1VHzmTvwPjoBxn2/QGTMuXnk8xQGGtdy
G8oav2RLBqvh0AD4fqd2fnMezJiRipXzYmWb1bySe48HRtHJrZ/aQQrUlPdNQwAe
EeixS97JEdBqtag41VhRBFxF9nML8ozA6cgj+Jm2M6OGU+M3tVhioEiuKPm6jXgl
3v8AA2CQrSJjhkTzinxE4FXa9O8INwziHSCE3GNIZaDCMYj7R8tTVcLaQWzUtdj/
i+0fI61n3ZOabvhLXttsdrtqcfNbrxCBVezoweg2RrVFcJc2GojCwJWt6a0cO+69
ggHZgpAwXsMmyMhhCbBXhnxBrsuGbN7f3YN2ty2veeFtp8uDvjCqmgJ5AG32w5E4
Ck9Rup6lwgq3YTQ4pTxl2y26HinobPrMzsZiWkZhN7elnVZL00kSF2Qn6x6xuAap
Z5oPkwZtYnM=
-----END CERTIFICATE-----

View file

@ -11,15 +11,13 @@
./hardware-configuration.nix
];
# No systemd emergency mode (can't reliably be accessed over SSH)
systemd.enableEmergencyMode = false;
# Use the GRUB 2 boot loader.
boot.loader.efi.canTouchEfiVariables = false;
boot.loader.efi.efiSysMountPoint = "/boot/efi";
boot.loader.grub = {
enable = true;
device = "nodev";
version = 2;
efiSupport = true;
enableCryptodisk = true;
efiInstallAsRemovable = true;
@ -30,16 +28,6 @@
"/keyfile1.bin" = /etc/secrets/initrd/keyfile1.bin;
};
# Remote SSH unlock
boot.initrd.network.enable = true;
boot.initrd.network.ssh = {
enable = true;
port = 22;
authorizedKeys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDM0Zvei46x/yZl/IeBCq6+IYQQ0avulzVyBysF9cPigZMCybWRV7IEU+E3k9t6JrbdbdGfJkcZIWmsWDdKS8W8mBnZpVoT0ffLynu8JQ/TKdGm4Qv6bgUeKNrGsNv0ZPs2CDaGSLj0oJfRF7Ko10tcLP0vW+yujrh+y6TH/vVzJioaV4TGvtCUpn+wEQah9ROwPQLUUofsSWdnRsDJ/gp37zXWs4l5wyjSKtP3O9RZUP7kBekbSqEgSXiTk0oUQSVqIWl9NDiP6onk/gSOjXsR/JPqsSN/XI/c/yj6gyY0f51Ru2D7iBxuMJIJcWV+rU6coIj+ULcQWLzt/7TI8jq5AOOzI/ll4zbL24Eo84Rz+TP9tvMMhDZ0VaMN22AJ8qQEjc5P09tWKsX7Jg39XelyV1jHXncE4yvIE9F4RSCHzWCeKeXakizQNuzSaxTxIExRFYHjNW5bR6+3MTGwVrEIXU+qML+0yFTR86MT+tdY5AreAJQLwbog79O1NupeXJE= anish@curve " ];
hostKeys = [ "/etc/secrets/initrd/ssh_host_ed25519_key" ]; # create this file with `ssh-keygen -t ed25519 -N "" -f /etc/secrets/initrd/ssh_host_ed25519_key`
};
boot.initrd.availableKernelModules = [ "igc" "iwlwifi" ];
boot.initrd.luks.devices = {
"root" = {
#name = "root";
@ -85,13 +73,16 @@
networking.useDHCP = false;
networking.interfaces.wlp3s0.useDHCP = true;
# Set your time zone.
time.timeZone = "Australia/Brisbane";
# Enable the OpenSSH daemon.
services.openssh.enable = true;
networking.firewall.allowedTCPPorts = [ 22 ];
sound.enable = false;
programs.gnupg.agent.enable = true;
programs.gnupg.agent.pinentryPackage = pkgs.pinentry-curses;
programs.gnupg.agent.pinentryFlavor = "curses";
programs.gnupg.agent.enableSSHSupport = true;
# This value determines the NixOS release with which your system is to be

View file

@ -1,38 +1,24 @@
{ self, pkgs, ... }: {
{ self, pkgs, profiles, suites, ... }:
{
imports = [
./configuration.nix
../profiles/core
../profiles/server
../profiles/taskd
../profiles/shaarli
../profiles/dns
# ../profiles/monitoring
../profiles/nfs
../profiles/gonic
# ../profiles/headphones # TODO broken on 23.11, see: https://github.com/rembo10/headphones/issues/3320
../profiles/radicale
# ../profiles/seafile # waiting for https://github.com/NixOS/nixpkgs/pull/249523 to be merged
../profiles/syncthing
../profiles/dhyan
../profiles/calibre
../profiles/wallabag
../profiles/finance
../profiles/sync/website
../profiles/grasp
# ../profiles/archivebox
# ../profiles/woodpecker-agent
# ../profiles/jellyfin
../profiles/ulogger-server
../profiles/photoprism # Replace with immich
../profiles/gpodder
#../profiles/postgres_upgrade_script
];
] ++ suites.mossnet;
home-manager.users.anish = { self, suites, ... }: {
imports = [ ] ++ suites.hmBase;
};
# For some reason this doesn't work in the profile, but does over here??
# Something weird in the way I'm importing nixpkgs in the profile or something
services."grasp".enable = true;
services."grasp".path = "/home/anish/kitaab/grasp/grasp.wiki";
services."grasp".user = "anish";
# Backups
age.secrets.borg-password.file = "${self}/secrets/borg-password.age";
services.postgresqlBackup = {
enable = true;
databases = [ "wallabag" "photoprism" "ulogger" ];
databases = [ "wallabag" ];
location = "/var/backup/postgresql";
};
mossnet.backup = {
@ -44,48 +30,15 @@
"/var/backup/postgresql" # wallabag
"/var/lib/radicale" # radicale
"/home/anish/usr/drawing" # syncthing
"/data/books" # calibre-web
# "/home/anish/usr/nonfiction" # syncthing
"/home/anish/usr/nonfiction" # syncthing
"/home/anish/usr/finance" # beancount
"/mnt/two/postgres" # sealight postgres backups TODO remove once moved to capsul
"/mnt/two/postgres" # sealight postgres backups TODO remove once moved to capsul
];
# seafile
};
services.transmission = {
enable = true;
settings = {
rpc.bind-address = "0.0.0.0";
download-dir = "/mnt/two/new-music";
};
};
services.nginx.virtualHosts."transmission.mossnet.lan" = {
enableACME = false;
forceSSL = false;
locations."/" = {
extraConfig = ''
proxy_pass http://localhost:9091/;
proxy_set_header X-Forwarded-Host $host;
'';
};
};
services.nginx.virtualHosts."mast.mossnet.lan" = {
enableACME = false;
forceSSL = false;
locations."/" = {
extraConfig = ''
proxy_pass http://localhost:5731/;
proxy_set_header X-Forwarded-Host $host;
'';
};
};
age.secrets.box-wg.file = "${self}/secrets/box-wg.age";
age.secrets.box-wg.owner = "anish";
age.secrets.borg-key.file = "${self}/secrets/borg-key.age";
mossnet.wg = {
enable = true;
ips = [ "10.0.69.4/24" ];

View file

@ -30,33 +30,18 @@
{
device = "/dev/disk/by-uuid/0f857c6e-509d-436f-9e78-bc25f1b0d23b";
fsType = "ext4";
options = [
"noatime"
"nodiratime"
"nofail"
];
};
fileSystems."/mnt/two" =
{
device = "/dev/disk/by-uuid/5bc894bf-ed87-4c30-aab4-87e154e0cd08";
fsType = "ext4";
options = [
"noatime"
"nodiratime"
"nofail"
];
};
fileSystems."/mnt/three" =
{
device = "/dev/disk/by-uuid/0be3ded1-9c8b-40aa-94ca-dc2297d5988e";
fsType = "ext4";
options = [
"noatime"
"nodiratime"
"nofail"
];
};
swapDevices =
@ -64,5 +49,4 @@
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
nixpkgs.hostPlatform = "x86_64-linux";
}

View file

@ -8,9 +8,11 @@
];
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "/dev/vda"; # or "nodev" for efi only
networking.hostName = "cube"; # Define your hostname.
time.timeZone = "Australia/Brisbane";
networking.useDHCP = false;
networking.interfaces.ens3.useDHCP = true;

View file

@ -2,15 +2,9 @@
{
imports = [
./configuration.nix
../profiles/core
../profiles/server
../profiles/site
];
] ++ suites.cube;
services.nginx.enable = true;
services.nginx.virtualHosts."coaching.lakhwara.com" = {
forceSSL = true;
enableACME = true;
locations."/" = { root = "/var/lib/coaching"; index = "/index.html"; };
home-manager.users.anish = { self, suites, ... }: {
imports = [ ] ++ suites.hmBase;
};
}

View file

@ -5,8 +5,7 @@
{
imports =
[
(modulesPath + "/profiles/qemu-guest.nix")
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ];
@ -15,19 +14,16 @@
boot.extraModulePackages = [ ];
fileSystems."/" =
{
device = "/dev/disk/by-uuid/9233d8be-539f-43c8-9b83-84b5b4d72a93";
{ device = "/dev/disk/by-uuid/9233d8be-539f-43c8-9b83-84b5b4d72a93";
fsType = "ext4";
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/E00D-9070";
{ device = "/dev/disk/by-uuid/E00D-9070";
fsType = "vfat";
};
swapDevices = [ ];
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
nixpkgs.hostPlatform = "x86_64-linux";
}

View file

@ -1,6 +1,7 @@
{
imports = [ ./hardware-configuration.nix ];
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
# Define on which hard drive you want to install Grub.
boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
@ -27,6 +28,15 @@
networking.hostName = "curve";
#networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
time.timeZone = "Australia/Brisbane";
networking.useDHCP = false;
networking.interfaces.enp0s31f6.useDHCP = true;
networking.interfaces.wlp3s0.useDHCP = true;
networking.wireless.enable = true;
networking.wireless.interfaces = [ "wlp3s0" ];
networking.wireless.userControlled.enable = true;
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
# console = {
@ -36,5 +46,5 @@
sound.enable = true;
services.libinput.enable = true;
services.xserver.libinput.enable = true;
}

16
hosts/curve/curve.nix Normal file
View file

@ -0,0 +1,16 @@
{ profiles, suites, ... }:
{
imports = [
profiles.core
profiles.users.anish
profiles.hardware.curve # how else to deal with hardware?
];
bud.enable = true;
# Speed up boot by removing dependency on network
systemd = {
targets.network-online.wantedBy = pkgs.lib.mkForce [ ]; # Normally ["multi-user.target"]
services.NetworkManager-wait-online.wantedBy = pkgs.lib.mkForce [ ]; # Normally ["network-online.target"]
};
}

View file

@ -1,45 +1,15 @@
{ self, pkgs, ... }: {
{ self, pkgs, profiles, suites, ... }:
{
imports = [
./configuration.nix
../users/anish
../profiles/core
../profiles/bluetooth
../profiles/music
../profiles/sync/cal
../profiles/wifi
../profiles/desktop
../profiles/mimetypes
../profiles/syncthing
../profiles/mossnet-hosts
# ../profiles/fly-wg
# ../profiles/kuberenetes
# ../profiles/mount-mossnet
];
profiles.mossnet-hosts
] ++ suites.curve;
# temporarily allow ssh access for work, to be able to do deploy new services
services.openssh = {
enable = true;
settings.PasswordAuthentication = false;
settings.PermitRootLogin = "no";
home-manager.users.anish = { suites, ... }: {
imports = suites.gui;
};
# import profiling tools
programs.systemtap.enable = true;
virtualisation.docker.enable = true;
virtualisation.docker.storageDriver = "btrfs";
environment.systemPackages = with pkgs; [ docker-compose ];
# Speed up boot by removing dependency on network
systemd = {
targets.network-online.wantedBy =
pkgs.lib.mkForce [ ]; # Normally ["multi-user.target"]
services.NetworkManager-wait-online.wantedBy =
pkgs.lib.mkForce [ ]; # Normally ["network-online.target"]
};
programs.gnupg.agent.enable = true;
programs.gnupg.agent.pinentryPackage = pkgs.pinentry-gnome3;
programs.gnupg.agent.pinentryFlavor = "gnome3";
fileSystems."/mnt/ftp" = {
device = "192.168.1.240:/home/ftp";
@ -70,15 +40,8 @@
# lazy enable of ports necessary for KDE connect which is installed via cli home profile (for some reason?)
networking.firewall = {
allowedTCPPorts = [ 22 ]; # allow ssh
allowedTCPPortRanges = [{
from = 1714;
to = 1764;
}];
allowedUDPPortRanges = [{
from = 1714;
to = 1764;
}];
allowedTCPPortRanges = [{ from = 1714; to = 1764; }];
allowedUDPPortRanges = [{ from = 1714; to = 1764; }];
};
age.secrets.curve-wg.file = "${self}/secrets/curve-wg.age";
@ -90,11 +53,10 @@
};
age.secrets.borg-password.file = "${self}/secrets/borg-password.age";
age.secrets.borg-key.file = "${self}/secrets/borg-key.age";
mossnet.backup = {
enable = true;
name = "curve";
paths = [ "/home/anish/usr" "/home/anish/.ssh" ];
paths = [ "/home/anish" ];
};
# enable adb
@ -103,8 +65,7 @@
#virtualisation.docker.enable = true;
boot.blacklistedKernelModules = [ "qcserial" ];
# Used for packer Capsul
users.users.anish.extraGroups =
[ "adbusers" "wheel" "plugdev" "libvertd" "docker" ];
users.users.anish.extraGroups = [ "adbusers" "wheel" "plugdev" "libvertd" ];
virtualisation.libvirtd.enable = true;
hardware.keyboard.zsa.enable = true;
services.udev.extraRules = ''

View file

@ -8,30 +8,30 @@
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/e1268753-4f18-4e6f-8edb-d4724ad8eb4a";
{ device = "/dev/disk/by-uuid/74ba39ee-35cd-4b87-9ee9-651384fa55bd";
fsType = "btrfs";
options = [ "subvol=root" ];
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/e1268753-4f18-4e6f-8edb-d4724ad8eb4a";
{ device = "/dev/disk/by-uuid/74ba39ee-35cd-4b87-9ee9-651384fa55bd";
fsType = "btrfs";
options = [ "subvol=home" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/8244-A184";
{ device = "/dev/disk/by-uuid/87DA-98E7";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/e220fea6-cf3b-4687-bfe1-9cf6d3ba57f7"; }
[ { device = "/dev/disk/by-uuid/c36e3ba9-8eee-4fbf-837c-7e1cfda33f09"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
@ -42,6 +42,6 @@
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -1,337 +0,0 @@
# Auto-generated using compose2nix v0.1.6.
{ pkgs, lib, ... }:
{
# Runtime
virtualisation.podman = {
enable = true;
autoPrune.enable = true;
dockerCompat = true;
defaultNetwork.settings = {
# Required for container networking to be able to use names.
dns_enabled = true;
};
};
virtualisation.oci-containers.backend = "podman";
# Containers
virtualisation.oci-containers.containers."blackbird-api" = {
image = "";
environment = {
API_DOMAIN = "http://localhost:3000";
DATABASE_URL = "postgresql://nomads:nomads@pgsql:5432/nomads?schema=public";
JWT_SECRET = "test1234";
MEDIA_LOCATION = "./data/media/";
MEDIA_LOCATION_DOWNLOAD_CACHE = "/data/media/downloadCache";
MEDIA_LOCATION_INCOMING = "/data/media/incoming";
MINIO_HOST = "minio";
MINIO_PORT = "9000";
MINIO_ROOT_PASSWORD = "password";
MINIO_ROOT_USER = "blackbird";
NODE_ENV = "development";
PORT = "3000";
POSTGRES_LOCAL_MACHINE_PORT = "5434";
POSTGRES_PASSWORD = "nomads";
POSTGRES_USER = "nomads";
REACT_APP_API_DOMAIN = "http://localhost:3000";
REDIS_HOST = "redis";
REDIS_PASSWORD = "password";
REDIS_PORT = "6379";
REFRESH_TOKEN_SECRET = "test1234";
STATIC_MEDIA_HOST = "http://localhost:3000";
STRIPE_KEY = "";
};
volumes = [
"/home/anish/.ssh:/root/.ssh:rw"
"/home/anish/usr/mirlo:/var/www/api:rw"
"/home/anish/usr/mirlo/data/media/downloadCache:/data/media/downloadCache:rw"
"/home/anish/usr/mirlo/data/media/incoming:/data/media/incoming:rw"
];
ports = [
"3000:3000/tcp"
];
cmd = [ "/bin/sh" "-c" "yarn && yarn migrate:deploy && yarn dev:api" ];
dependsOn = [
"blackbird-minio"
"blackbird-pgsql"
"blackbird-redis"
];
log-driver = "journald";
extraOptions = [
"--network-alias=api"
"--network=mirlo-api-network"
"--network=mirlo-redis-network"
];
};
systemd.services."podman-blackbird-api" = {
serviceConfig = {
Restart = lib.mkOverride 500 "always";
};
after = [
"podman-network-mirlo-api-network.service"
"podman-network-mirlo-redis-network.service"
];
requires = [
"podman-network-mirlo-api-network.service"
"podman-network-mirlo-redis-network.service"
];
partOf = [
"podman-compose-mirlo-root.target"
];
unitConfig.UpheldBy = [
"podman-blackbird-minio.service"
"podman-blackbird-pgsql.service"
"podman-blackbird-redis.service"
];
wantedBy = [
"podman-compose-mirlo-root.target"
];
};
virtualisation.oci-containers.containers."blackbird-background" = {
image = "";
environment = {
API_DOMAIN = "http://localhost:3000";
DATABASE_URL = "postgresql://nomads:nomads@pgsql:5432/nomads?schema=public";
JWT_SECRET = "test1234";
MEDIA_LOCATION = "./data/media/";
MEDIA_LOCATION_DOWNLOAD_CACHE = "/data/media/downloadCache";
MEDIA_LOCATION_INCOMING = "/data/media/incoming";
MINIO_HOST = "minio";
MINIO_PORT = "9000";
MINIO_ROOT_PASSWORD = "password";
MINIO_ROOT_USER = "blackbird";
NODE_ENV = "development";
PORT = "3000";
POSTGRES_LOCAL_MACHINE_PORT = "5434";
POSTGRES_PASSWORD = "nomads";
POSTGRES_USER = "nomads";
REACT_APP_API_DOMAIN = "http://localhost:3000";
REDIS_HOST = "redis";
REDIS_PASSWORD = "password";
REDIS_PORT = "6379";
REFRESH_TOKEN_SECRET = "test1234";
STATIC_MEDIA_HOST = "http://localhost:3000";
STRIPE_KEY = "";
};
volumes = [
"/home/anish/.ssh:/root/.ssh:rw"
"/home/anish/usr/mirlo:/var/www/api:rw"
"/home/anish/usr/mirlo/data/media/processing:/data/media/processing:rw"
];
dependsOn = [
"blackbird-api"
"blackbird-minio"
"blackbird-pgsql"
"blackbird-redis"
];
log-driver = "journald";
extraOptions = [
"--network-alias=background"
"--network=mirlo-api-network"
"--network=mirlo-redis-network"
];
};
systemd.services."podman-blackbird-background" = {
serviceConfig = {
Restart = lib.mkOverride 500 "always";
};
after = [
"podman-network-mirlo-api-network.service"
"podman-network-mirlo-redis-network.service"
];
requires = [
"podman-network-mirlo-api-network.service"
"podman-network-mirlo-redis-network.service"
];
partOf = [
"podman-compose-mirlo-root.target"
];
unitConfig.UpheldBy = [
"podman-blackbird-api.service"
"podman-blackbird-minio.service"
"podman-blackbird-pgsql.service"
"podman-blackbird-redis.service"
];
wantedBy = [
"podman-compose-mirlo-root.target"
];
};
virtualisation.oci-containers.containers."blackbird-minio" = {
image = "minio/minio";
environment = {
API_DOMAIN = "http://localhost:3000";
DATABASE_URL = "postgresql://nomads:nomads@pgsql:5432/nomads?schema=public";
JWT_SECRET = "test1234";
MEDIA_LOCATION = "./data/media/";
MEDIA_LOCATION_DOWNLOAD_CACHE = "/data/media/downloadCache";
MEDIA_LOCATION_INCOMING = "/data/media/incoming";
MINIO_HOST = "minio";
MINIO_PORT = "9000";
MINIO_ROOT_PASSWORD = "password";
MINIO_ROOT_USER = "blackbird";
PORT = "3000";
POSTGRES_LOCAL_MACHINE_PORT = "5434";
POSTGRES_PASSWORD = "nomads";
POSTGRES_USER = "nomads";
REACT_APP_API_DOMAIN = "http://localhost:3000";
REDIS_HOST = "redis";
REDIS_PASSWORD = "password";
REDIS_PORT = "6379";
REFRESH_TOKEN_SECRET = "test1234";
STATIC_MEDIA_HOST = "http://localhost:3000";
STRIPE_KEY = "";
};
volumes = [
"/home/anish/usr/mirlo/data/minio_storage:/data:rw"
];
ports = [
"9000:9000/tcp"
"9001:9001/tcp"
];
cmd = [ "server" "--console-address" ":9001" "/data" ];
log-driver = "journald";
extraOptions = [
"--network-alias=minio"
"--network=mirlo-api-network:alias=minio"
];
};
systemd.services."podman-blackbird-minio" = {
serviceConfig = {
Restart = lib.mkOverride 500 "no";
};
after = [
"podman-network-mirlo-api-network.service"
];
requires = [
"podman-network-mirlo-api-network.service"
];
partOf = [
"podman-compose-mirlo-root.target"
];
wantedBy = [
"podman-compose-mirlo-root.target"
];
};
virtualisation.oci-containers.containers."blackbird-pgsql" = {
image = "postgres:14-alpine";
environment = {
API_DOMAIN = "http://localhost:3000";
DATABASE_URL = "postgresql://nomads:nomads@pgsql:5432/nomads?schema=public";
JWT_SECRET = "test1234";
MEDIA_LOCATION = "./data/media/";
MEDIA_LOCATION_DOWNLOAD_CACHE = "/data/media/downloadCache";
MEDIA_LOCATION_INCOMING = "/data/media/incoming";
MINIO_HOST = "minio";
MINIO_PORT = "9000";
MINIO_ROOT_PASSWORD = "password";
MINIO_ROOT_USER = "blackbird";
PORT = "3000";
POSTGRES_LOCAL_MACHINE_PORT = "5434";
POSTGRES_PASSWORD = "nomads";
POSTGRES_USER = "nomads";
REACT_APP_API_DOMAIN = "http://localhost:3000";
REDIS_HOST = "redis";
REDIS_PASSWORD = "password";
REDIS_PORT = "6379";
REFRESH_TOKEN_SECRET = "test1234";
STATIC_MEDIA_HOST = "http://localhost:3000";
STRIPE_KEY = "";
};
volumes = [
"/home/anish/usr/mirlo/data/pgsql:/var/lib/postgresql/data:rw"
"/home/anish/usr/mirlo/data/pgsql_backups:/backups:rw"
];
ports = [
"5432:5432/tcp"
];
log-driver = "journald";
extraOptions = [
"--network-alias=pgsql"
"--network=mirlo-api-network:alias=pgsql"
];
};
systemd.services."podman-blackbird-pgsql" = {
serviceConfig = {
Restart = lib.mkOverride 500 "no";
};
after = [
"podman-network-mirlo-api-network.service"
];
requires = [
"podman-network-mirlo-api-network.service"
];
partOf = [
"podman-compose-mirlo-root.target"
];
wantedBy = [
"podman-compose-mirlo-root.target"
];
};
virtualisation.oci-containers.containers."blackbird-redis" = {
image = "redis";
ports = [
"6379:6379/tcp"
];
cmd = [ "redis-server" "--appendonly" "yes" "--requirepass " ];
log-driver = "journald";
extraOptions = [
"--network-alias=redis"
"--network=mirlo-redis-network"
];
};
systemd.services."podman-blackbird-redis" = {
serviceConfig = {
Restart = lib.mkOverride 500 "always";
};
after = [
"podman-network-mirlo-redis-network.service"
];
requires = [
"podman-network-mirlo-redis-network.service"
];
partOf = [
"podman-compose-mirlo-root.target"
];
wantedBy = [
"podman-compose-mirlo-root.target"
];
};
# Networks
systemd.services."podman-network-mirlo-api-network" = {
path = [ pkgs.podman ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStop = "${pkgs.podman}/bin/podman network rm -f mirlo-api-network";
};
script = ''
podman network inspect mirlo-api-network || podman network create mirlo-api-network --opt isolate=true
'';
partOf = [ "podman-compose-mirlo-root.target" ];
wantedBy = [ "podman-compose-mirlo-root.target" ];
};
systemd.services."podman-network-mirlo-redis-network" = {
path = [ pkgs.podman ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStop = "${pkgs.podman}/bin/podman network rm -f mirlo-redis-network";
};
script = ''
podman network inspect mirlo-redis-network || podman network create mirlo-redis-network --opt isolate=true
'';
partOf = [ "podman-compose-mirlo-root.target" ];
wantedBy = [ "podman-compose-mirlo-root.target" ];
};
# Root service
# When started, this will automatically create all resources and start
# the containers. When stopped, this will teardown all resources.
systemd.targets."podman-compose-mirlo-root" = {
unitConfig = {
Description = "Root target generated by compose2nix.";
};
wantedBy = [ "multi-user.target" ];
};
}

View file

@ -8,6 +8,7 @@
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "/dev/vda"; # or "nodev" for efi only
networking.hostName = "helix"; # Define your hostname.
@ -21,6 +22,8 @@
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.openssh.passwordAuthentication = false;
services.openssh.permitRootLogin = "no";
sound.enable = false;
# Define a user account. Don't forget to set a password with passwd.

View file

@ -1,20 +1,12 @@
{ self, profiles, suites, pkgs, ... }:
{ self, profiles, suites, ... }:
{
imports = [
./configuration.nix
../profiles/core
../profiles/server
# ../profiles/metrics
../profiles/gitea
# ../profiles/woodpecker-server
../profiles/rss-bridge
# ../profiles/mount-mossnet
../profiles/freshrss
../profiles/microbin
../profiles/site
# ../profiles/postgres_upgrade_script
];
] ++ suites.sealight;
home-manager.users.anish = { self, suites, ... }: {
imports = [ ] ++ suites.hmBase;
};
# Capsul specific
users.users.cyberian = {
@ -22,31 +14,22 @@
extraGroups = [ "wheel" ];
};
age.secrets.helix-wg.file = "${self}/secrets/helix-wg.age";
age.secrets.helix-wg.owner = "anish";
mossnet.wg = {
enable = true;
ips = [ "10.0.69.5/24" ];
privateKeyFile = "/run/agenix/helix-wg";
privateKeyFile = "/home/anish/wg/wg-priv";
};
services.postgresql.package = pkgs.postgresql_15;
services.postgresqlBackup = {
# TODO needs working wireguard to box
enable = false;
databases = [ "gitea" "freshrss" ]; # "woodpecker"
location = "/mnt/two/postgres";
};
# mossnet.backup = {
# enable = false;
# name = "sealight";
# paths = [ "/var/backup/postgresql" ];
# };
mossnet.backup = {
enable = true;
name = "helix";
paths = [
"/var/lib/gitea"
"/var/lib/freshrss"
# "/var/lib/woodpecker"
"/var/lib/microbin"
];
};
# age.secrets.borg-password.file = "${self}/secrets/borg-password.age";
# services.postgresqlBackup = {
# enable = false;
# databases = [ "matrix-synapse" "gitea" ];
# location = "/var/backup/postgresql";
# };
}

View file

@ -1,51 +0,0 @@
{ disks ? [ "/dev/vdb" ], ... }: {
disko.devices = {
disk = {
vdb = {
type = "disk";
device = builtins.elemAt disks 0;
content = {
type = "table";
format = "gpt";
partitions = [
{
name = "ESP";
start = "1MiB";
end = "128MiB";
fs-type = "fat32";
bootable = true;
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
}
{
name = "root";
start = "128MiB";
end = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ]; # Override existing partition
subvolumes = {
# Subvolume name is different from mountpoint
"/rootfs" = {
mountpoint = "/";
};
# Mountpoints inferred from subvolume name
"/home" = {
mountOptions = [ "compress=zstd" ];
};
"/nix" = {
mountOptions = [ "compress=zstd" "noatime" ];
};
};
};
}
];
};
};
};
};
}

View file

@ -5,27 +5,22 @@
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
[
(modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "virtio_pci" "floppy" "sr_mod" "virtio_blk" ];
boot.initrd.availableKernelModules = [ "ata_piix" "floppy" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/7c560634-d545-41cc-b375-42ce3037fd73";
{
device = "/dev/disk/by-uuid/7c560634-d545-41cc-b375-42ce3037fd73";
fsType = "ext4";
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.ens3.useDHCP = lib.mkDefault true;
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -8,6 +8,7 @@
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "/dev/vda"; # or "nodev" for efi only
networking.hostName = "lituus"; # Define your hostname.

View file

@ -2,25 +2,10 @@
{
imports = [
./configuration.nix
../profiles/core
../profiles/server
../profiles/metrics
../profiles/sealight-website
../profiles/matrix
../profiles/wireguard-server
];
] ++ suites.lituus;
# mossnet.backup = {
# enable = false;
# name = "sealight";
# paths = [ "/var/backup/postgresql" ];
# };
# age.secrets.borg-password.file = "${self}/secrets/borg-password.age";
# services.postgresqlBackup = {
# enable = false;
# databases = [ "matrix-synapse" "gitea" ];
# location = "/var/backup/postgresql";
# };
home-manager.users.anish = { self, suites, ... }: {
imports = [ ] ++ suites.hmBase;
};
}

View file

@ -9,7 +9,7 @@
(modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "floppy" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
@ -22,6 +22,5 @@
swapDevices = [ ];
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
nixpkgs.hostPlatform = "x86_64-linux";
nix.maxJobs = lib.mkDefault 1;
}

View file

@ -1,75 +0,0 @@
{ config, options, lib, pkgs, ... }:
with lib;
let
# cfg = config.services.archivebox;
dataDir = "/var/lib/archivebox";
user = "archivebox";
port = "8123";
in
{
nixpkgs.config.permittedInsecurePackages = [
"python3.10-django-3.1.14"
];
services.nginx.virtualHosts."archive.mossnet.lan" = {
enableACME = false;
forceSSL = false;
locations."/" = {
extraConfig = ''
proxy_pass http://localhost:${port}/;
proxy_set_header X-Forwarded-Host $host;
'';
};
};
systemd.services.archivebox-install = {
description = "archivebox install service";
wantedBy = [ "multi-user.target" ];
path = with pkgs; [ coreutils archivebox ];
serviceConfig = {
User = user;
Type = "oneshot";
RemainAfterExit = "yes";
PermissionsStartOnly = true;
};
preStart = ''
mkdir -p "${dataDir}"
chown ${user} "${dataDir}"
'';
script = ''
echo "Setting up archivebox files in ${dataDir} ..."
cd "${dataDir}"
archivebox init
'';
};
systemd.services.archivebox-server = {
description = "archivebox server service";
wantedBy = [ "multi-user.target" ];
path = with pkgs; [ coreutils archivebox ];
serviceConfig = {
User = user;
Type = "oneshot";
RemainAfterExit = "yes";
PermissionsStartOnly = true;
};
preStart = ''
mkdir -p "${dataDir}"
chown ${user} "${dataDir}"
'';
script = ''
echo "Setting up wallabag files in ${dataDir} ..."
cd "${dataDir}"
archivebox server 0.0.0.0:${port}
'';
};
}

View file

@ -1,68 +0,0 @@
#!/usr/bin/env bash
# notify a khal user via rofi about upcoming events
#
# dependencies: ·khal
# ·rofi >= 1.7.0 (-timeout-delay 60 -timeout-action "kb-cancel")
# ·column (eye candy only. can be removed without problems)
#
# usage: put it into a cronjob and let it run every 15 min or so
# -only events with reminders will trigger an alarm (shown in khal as: ⏰)
# -snoozed events will show up again on the next run
# -dismissed events will not trigger an alarm again
# -no alarm will be triggered if the script did never run
# for the duration of an event or in TIMESPAN beforehand
#
# rofi: -Shift+Return toggles item selection
# -if any item is selected, "cursor" position has no effect
# -timeout after 60 seconds; this snoozes all events
####################
# adjust cache file location to your liking
cache_file="${XDG_CACHE_HOME:-$HOME/.cache}/khal-events"
# events starting in the next TIMESPAN will trigger an alarm
timespan='60min'
####################
# this is needed for cronjobs and Xorg
export DISPLAY=":0"
snooze_string='💤 Snooze all.'
dismiss_string='✅ Dismiss all.'
# only show events with ⏰ symbol (=has alarm set)
# remove arrows for all-day events to only have one notification
# remove ⏰ symbol because it is obvious
events="$(khal list --format \
'{calendar}: {cancelled}{start-style}{to-style}{end-style} {title}{description-separator}{description}{location}{repeat-symbol}{alarm-symbol}' \
now "${timespan}" \
| sed -ne '/⏰/ p' \
| sed -e 's/⏰//g' -e 's/\(↦\|↔\|⇥\)[^[:blank:]]*/all-day/g' \
| column -tl 3)"
# get events that are new compared to cache file
new_events="$(diff -NwU 0 "${cache_file}" - << EOF | sed -ne '/^\+[^+]/ p' \
| sed -ne 's/^\+\([[:print:]].*\)$/\1/p'
${events}
EOF
)"
[ -z "${new_events}" ] && exit 0
action="$(dunstify --action="default,Dismiss" --action="snooze,Snooze" "${new_events}")"
# input="$(printf '%s\n%s\n%s' "${snooze_string}" \
# "${dismiss_string}" "${new_events}" \
# | rofi -timeout-delay 60 -timeout-action "kb-cancel" \
# -dmenu -i -u 2: -no-custom -multi-select -p \
# '⏰ Alarm! Select alarms to snooze. Rest will be dismissed.')"
case "${action}" in
"snooze")
;;
"default")
printf '%s' "${events}" > "${cache_file}"
;;
*)
printf '%s' "${events}" | grep -Fve "${input}" > "${cache_file}"
;;
esac

View file

@ -1,25 +0,0 @@
{ pkgs, ... }:
{
systemd.services.cal-alarms = {
serviceConfig.Type = "simple";
path = [
pkgs.libnotify
pkgs.dunst
pkgs.khal
pkgs.unixtools.column
pkgs.diffutils
];
startAt = "*08:00:00";
script = builtins.readFile ./alarm.sh;
serviceConfig = {
User = "anish";
Environment = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus";
};
};
systemd.timers.cal-alarms = {
wantedBy = [ "timers.target" ];
partOf = [ "cal-alarms.service" ];
timerConfig.OnCalendar = [ "*:0/10" ];
};
}

View file

@ -1,89 +0,0 @@
{ config, pkgs, lib, ... }:
let
adblockLocalZones = pkgs.stdenv.mkDerivation {
name = "unbound-zones-adblock";
src = (pkgs.fetchFromGitHub {
owner = "StevenBlack";
repo = "hosts";
rev = "3.12.21";
sha256 = "Yzr6PY/zqQE+AHH0J6ioHTsgkikM+dz4aelbGpQJa1s=";
} + "/hosts");
phases = [ "installPhase" ];
installPhase = ''
${pkgs.gawk}/bin/awk '{sub(/\r$/,"")} {sub(/^127\.0\.0\.1/,"0.0.0.0")} BEGIN { OFS = "" } NF == 2 && $1 == "0.0.0.0" { print "local-zone: \"", $2, "\" static"}' $src | tr '[:upper:]' '[:lower:]' | sort -u > $out
'';
};
mossnet = "192.168.1.240"; # The local lan-ip for box
wg-mossnet = "10.0.69.4"; # The wireguard ip for box
mossnet-hosts = [
"mossnet.lan"
"headphones.mossnet.lan"
"links.mossnet.lan"
"read.mossnet.lan"
"stats.mossnet.lan"
"music.mossnet.lan"
"tasks.mossnet.lan"
"file.mossnet.lan"
"books.mossnet.lan"
"fin.mossnet.lan"
"paper.mossnet.lan"
"cal.mossnet.lan"
"archive.mossnet.lan"
"headphones.mossnet.lan"
"transmission.mossnet.lan"
"tracks.mossnet.lan"
"grasp.mossnet.lan"
"photos.mossnet.lan"
"pod.mossnet.lan"
"mast.mossnet.lan"
];
in {
services.unbound = {
enable = true;
settings = {
server = {
include = "${adblockLocalZones}";
prefetch = "yes";
# private-address = "10.0.69.0/8";
# private-address = "192.168.1.0/24";
cache-min-ttl = 0;
serve-expired = "yes";
interface = [ "0.0.0.0" ];
access-control =
[ "127.0.0.0/8 allow" "192.168.1.0/24 allow" "10.0.69.0/24 allow" ];
access-control-view = "10.0.69.0/24 wireguard";
# so-reuseport = "yes";
tls-upstream = "yes";
domain-insecure = "mossnet.lan";
local-zone = ''"mossnet.lan." redirect'';
local-data = ''"mossnet.lan. IN A ${mossnet}"'';
};
forward-zone = [{
name = ".";
forward-addr = [
"45.90.28.0#6939b9.dns.nextdns.io"
"1.1.1.1@853#cloudflare-dns.com"
];
# non-tls
# forward-addr = ["45.90.30.49" "45.90.28.49" "1.1.1.1" "8.8.8.8"]
}];
view = {
name = "wireguard";
local-zone = ''"mossnet.lan." redirect'';
local-data = ''"mossnet.lan. IN A ${wg-mossnet}"'';
};
};
};
# With unbound we're doing wildcard redirects, so we don't need that anymore
# networking.hosts = {
# mossnet = mossnet-hosts;
# };
networking.firewall.allowedTCPPorts = [ 53 ];
networking.firewall.allowedUDPPorts = [ 53 ];
}

View file

@ -1,6 +0,0 @@
{ pkgs, config, lib, ... }:
{
networking.wireguard.interfaces.fly-wg = "/home/anish/usr/fly-io-test/fly-wg.conf";
# ssh.startAgent = true;
}

View file

@ -1,45 +0,0 @@
{ self, config, lib, pkgs, ... }:
{
age.secrets.freshrss-dbpass.file = "${self}/secrets/freshrss-dbpass.age";
age.secrets.freshrss-dbpass.owner = "freshrss";
services.freshrss = {
enable = true;
virtualHost = "rss.sealight.xyz";
baseUrl = "https://rss.sealight.xyz/";
passwordFile = "/run/agenix/freshrss-dbpass";
database = {
type = "pgsql";
passFile = "/run/agenix/freshrss-dbpass";
port = 5432;
};
};
services.postgresql = {
enable = true; # Ensure postgresql is enabled
# authentication = ''
# local freshrss all ident map=freshrss-users
# '';
# identMap = # Map the freshrss user to postgresql
# ''
# freshrss-users freshrss freshrss
# freshrss-users postgres freshrss
# '';
ensureDatabases = [ "freshrss" ];
ensureUsers = [{
name = "freshrss";
ensureDBOwnership = true;
}];
# TODO
# initialScript # set password for freshrss user
};
services.nginx.virtualHosts."rss.sealight.xyz" = {
enableACME = true;
forceSSL = true;
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
security.acme.defaults.email = "anish+acme@lakhwara.com";
security.acme.acceptTerms = true;
}

View file

@ -1,95 +0,0 @@
{ self, config, lib, pkgs, ... }:
{
age.secrets.gitea-dbpass.file = "${self}/secrets/gitea-dbpass.age";
age.secrets.gitea-dbpass.owner = "gitea";
services.forgejo = {
enable = true;
user = "gitea";
group = "gitea";
stateDir = "/var/lib/gitea";
database = {
type = "postgres";
user = "gitea";
name = "gitea";
passwordFile = "/run/agenix/gitea-dbpass";
};
settings = {
DEFAULT.APP_NAME = "Sealight Git Forge";
server = {
DOMAIN = "git.sealight.xyz";
ROOT_URL = "https://git.sealight.xyz";
HTTP_PORT = 3001;
};
metrics = {
ENABLED = true;
};
repository = {
DEFAULT_BRANCH = "main";
};
service.DISABLE_REGISTRATION = true;
"markup.restructuredtext" = {
ENABLED = true;
FILE_EXTENSIONS = ".rst";
RENDER_COMMAND = "timeout 30s pandoc +RTS -RTS -f rst";
IS_INPUT_FILE = false;
};
mailer = {
ENABLED = true;
MAILER_TYPE = "smtp";
FROM = "ops@sealight.xyz";
SMTP_ADDR = "smtp.nullhex.com";
SMTP_PORT = "465";
USER = "ops@sealight.xyz";
PASSWD = "breed deputy fossil glory"; # TODO how do we pass this from agenix?
IS_TLS_ENABLED = "true";
};
};
};
users.users.gitea = {
home = "/var/lib/gitea";
useDefaultShell = true;
group = "gitea";
isSystemUser = true;
};
users.groups.gitea = {};
environment.systemPackages = [ pkgs.pandoc ];
services.postgresql = {
enable = true; # Ensure postgresql is enabled
# authentication = ''
# local gitea all ident map=gitea-users
# '';
# identMap = # Map the gitea user to postgresql
# ''
# gitea-users gitea gitea
# gitea-users postgres gitea
# '';
ensureDatabases = [ "gitea" ];
ensureUsers = [{
name = "gitea";
ensureDBOwnership = true;
}];
# TODO
# initialScript
# set password for gitea user
};
services.nginx = {
enable = true; # Enable Nginx
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
virtualHosts."git.sealight.xyz" = {
# Gitea hostname
enableACME = true; # Use ACME certs
forceSSL = true; # Force SSL
locations."/".proxyPass = "http://localhost:3001/"; # Proxy Gitea
};
};
networking.firewall.allowedTCPPorts = [ 80 443 22 ];
}

View file

@ -1,21 +0,0 @@
{ config, lib, pkgs, ... }:
{
mossnet.gonic.enable = true;
mossnet.gonic.settings = ''
music-path /mnt/two/music/
podcast-path /data/podcasts
cache-path /data/cache
playlists-path /data/playlists
'';
mossnet.gonic.user = "gonic";
mossnet.gonic.group = "audio";
networking.firewall.allowedTCPPorts = [ 4747 ];
users.users.gonic = {
# uid = config.ids.uids.headphones;
# isSystemUser = true;
group = "audio";
# home = "/var/lib/headphones";
createHome = true;
};
}

View file

@ -1,16 +0,0 @@
{
services.gpodder.enable = true;
networking.firewall.allowedTCPPorts = [ 3005 ];
services.nginx.virtualHosts."pod.mossnet.lan" = {
extraConfig = "client_max_body_size 20M;";
locations."/" = {
extraConfig = ''
proxy_pass http://localhost:3005/;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
'';
};
};
}

View file

@ -1,12 +0,0 @@
{ ... }:
{
services.grasp = {
enable = true;
path = "/home/anish/kitaab/grasp/notes.wiki";
user = "anish";
};
services.nginx.virtualHosts."grasp.mossnet.lan" = {
locations."/".proxyPass = "http://localhost:12212";
};
}

View file

@ -1,22 +0,0 @@
{ config, lib, pkgs, ... }:
{
services.headphones = {
enable = true;
host = "0.0.0.0";
port = 8181;
package = "${pkgs.unstable.headphones}";
user = "headphones";
group = "audio";
dataDir = "/data/music";
};
services.nginx.virtualHosts."headphones.mossnet.lan" = {
enableACME = false;
forceSSL = false;
locations."/" = {
extraConfig = ''
proxy_pass http://127.0.0.1:8181/;
'';
};
};
}

View file

@ -1,27 +0,0 @@
{ config, lib, pkgs, ... }:
{
# Enable Hardware Acceleration for transcoding
nixpkgs.config.packageOverrides = pkgs: {
vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
};
hardware.opengl = {
enable = true;
extraPackages = with pkgs; [
intel-media-driver
vaapiIntel
vaapiVdpau
libvdpau-va-gl
intel-compute-runtime # OpenCL filter support (hardware tonemapping and subtitle burn-in)
];
};
services.jellyfin = {
enable = true;
user = "jellyfin";
group = "video";
openFirewall = true; # only for defaults
};
networking.firewall.allowedTCPPorts = [ 8181 ];
users.users.jellyfin = {
extraGroups = [ "video" "audio" ];
};
}

View file

@ -1,20 +0,0 @@
{ pkgs, ... }:
{
# k3s
networking.firewall.allowedTCPPorts = [ 6443 ];
services.k3s.enable = true;
services.k3s.role = "server";
services.k3s.clusterInit = false;
# services.k3s.extraFlags = toString [
# "--kubelet-arg=v=4" # Optionally add additional args to k3s
# ];
environment.systemPackages = [ pkgs.k3s pkgs.kubernetes-helm pkgs.kubectl ];
# minikube on docker
virtualisation.docker.enable = true;
virtualisation.docker.storageDriver = "btrfs";
# or use kvm
# virtualisation.libvirtd.enable = true;
users.users.anish.extraGroups = [ "docker" "libvert" ]; #
}

View file

@ -1,52 +0,0 @@
{ config, lib, pkgs, ... }:
{
# Mautrix-signal settings
services.signald.enable = true;
systemd.services.matrix-as-signal = {
requires = [ "signald.service" ];
after = [ "signald.service" ];
unitConfig = {
JoinsNamespaceOf = "signald.service";
};
path = [
pkgs.ffmpeg # voice messages need `ffmpeg`
];
};
services.matrix-appservices = {
addRegistrationFiles = false;
homeserverURL = "https://sealight.xyz/";
homeserverDomain = "sealight.xyz";
services = {
whatsapp = {
port = 29183;
format = "mautrix-go";
package = pkgs.mautrix-whatsapp;
};
discord = {
port = 29188;
format = "mautrix-go";
package = pkgs.my-mautrix-discord;
};
signal = {
port = 29184;
format = "mautrix-python";
package = pkgs.unstable.mautrix-signal;
serviceConfig = {
StateDirectory = [ "matrix-as-signal" "signald" ];
SupplementaryGroups = [ "signald" ];
TimeoutStopSec = 1; # work around the service ignoring SIGTERM, see https://gitlab.com/coffeetables/nix-matrix-appservices/-/issues/12
User = lib.mkForce config.services.signald.user;
Group = lib.mkForce config.services.signald.group;
};
settings.signal = {
socket_path = config.services.signald.socketPath;
outgoing_attachment_dir = "/var/lib/signald/tmp";
};
};
};
};
}

View file

@ -1,21 +0,0 @@
{ config, lib, pkgs, ... }:
{
services.microbin.enable = true;
services.microbin.settings.PUBLIC_PATH = "bin.sealight.xyz";
services.microbin.settings.MICROBIN_PORT = 4949;
networking.firewall.allowedTCPPorts = [ 4949 ];
services.nginx.virtualHosts."bin.sealight.xyz" = {
enableACME = true;
forceSSL = true;
extraConfig = "client_max_body_size 20M;";
locations."/" = {
extraConfig = ''
proxy_pass http://localhost:4949/;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
'';
};
};
}

Some files were not shown because too many files have changed in this diff Show more