-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
152 lines (138 loc) · 5.4 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
{
inputs = {
# TODO there's a bug that prevents xrandr from rotating
# screens. This is currently preventing me from upgrading
# nixpkgs. See https://github.com/NixOS/nixpkgs/issues/87989.
nixpkgs.url = "github:nixos/nixpkgs/7e9b0dff974c89e070da1ad85713ff3c20b0ca97";
home.url = "github:rycee/home-manager/release-21.05";
emacsOverlay.url = "github:nix-community/emacs-overlay";
mach-nix.url = "github:DavHau/mach-nix";
## package overrides
# 2021-04-07
# Updates sage to version 9.4. Remove when nixpkgs passes this point.
sageNixpkgs.url = "github:nixos/nixpkgs/46c3703ec1fe45767a8781e290ed874704d5d18e";
paraviewNixpkgs.url = "github:nixos/nixpkgs/72158c231ae46a34ec16b8134d2a8598506acd9c";
vivadoNixpkgs.url = "github:matthuszagh/nixpkgs/vivado";
ladyHeatherNixpkgs.url = "github:matthuszagh/nixpkgs/lady-heather";
dsviewNixpkgs.url = "github:nixos/nixpkgs/00b385c61226a3f3c396581fd7b4851d99e20910";
# remove when PR accepted: https://github.com/NixOS/nixpkgs/pull/173184
inkscapeNixpkgs.url = "github:matthuszagh/nixpkgs/6af0581cc7182d83a9813bd3c30cf7230807a701";
# https://github.com/NixOS/nixpkgs/issues/94315#issuecomment-719892849
mesaNixpkgs.url = "github:nixos/nixpkgs/bdac777becdbb8780c35be4f552c9d4518fe0bdb";
asymptoteNixpkgs.url = "github:nixos/nixpkgs/6eeb612a9b6160df2e110021d93bef3e6e538b9a";
curaNixpkgs.url = "github:nixos/nixpkgs/797f77ab66f17c0c7e8c10b137a213d56c9ff36d";
freecadNixpkgs.url = "github:nixos/nixpkgs/797f77ab66f17c0c7e8c10b137a213d56c9ff36d";
linuxGpibNixpkgs.url = "github:matthuszagh/nixpkgs/e771cd3751af64028e08c0db42ac7ddd0e66ae00";
# https://github.com/NixOS/nix/pull/4641
nixNixpkgs.url = "github:nixos/nixpkgs/c4070d4ce39adc0d27f478f9f02cafcec121be63";
};
outputs =
{ self
, nixpkgs
, home
, emacsOverlay
, mach-nix
, sageNixpkgs
, paraviewNixpkgs
, vivadoNixpkgs
, ladyHeatherNixpkgs
, inkscapeNixpkgs
, dsviewNixpkgs
, mesaNixpkgs
, asymptoteNixpkgs
, curaNixpkgs
, freecadNixpkgs
, linuxGpibNixpkgs
, nixNixpkgs
}:
let
inherit (builtins) attrNames attrValues readDir;
inherit (nixpkgs) lib;
inherit (lib) recursiveUpdate genAttrs mapAttrs' nameValuePair;
inherit (utils) pathsToImportedAttrs;
utils = import ./lib/utils.nix { inherit lib; };
system = "x86_64-linux";
externalOverlays = [
emacsOverlay.overlay
];
pkgImport = pkgs: import pkgs {
inherit system;
# Order is significant. First incorporate external overlays. We
# can then use and override these in custom packages (defined
# in `self.overlay`). Finally overlays in ./overlays can
# override everything else.
overlays = externalOverlays
++ [ self.overlay ]
++ (attrValues self.overlays);
config = {
allowUnfree = true;
permittedInsecurePackages = [
"openssh-with-hpn-8.4p1"
];
};
};
overridePkgs =
let
mnix = (import mach-nix {
# This allows us to use python packages from
# linuxGpibNixpkgs in requirements.
pkgs = (import linuxGpibNixpkgs { inherit system; }).pkgs;
});
in
{
sageWithDoc = (pkgImport sageNixpkgs).sageWithDoc;
paraview = (pkgImport paraviewNixpkgs).paraview;
vivado = (pkgImport vivadoNixpkgs).vivado;
lady-heather = (pkgImport ladyHeatherNixpkgs).lady-heather;
dsview = (pkgImport dsviewNixpkgs).dsview;
inkscape = (pkgImport inkscapeNixpkgs).inkscape;
mesa_drivers = (pkgImport mesaNixpkgs).mesa_drivers;
asymptote = (pkgImport asymptoteNixpkgs).asymptote;
cura = (pkgImport curaNixpkgs).cura;
freecad = (pkgImport freecadNixpkgs).freecad;
linux-gpib = (pkgImport linuxGpibNixpkgs).linux-gpib;
nixFlakes = (pkgImport nixNixpkgs).nixFlakes;
mach-nix = mnix.mach-nix;
# TODO this should be in profiles/dev/python/default.nix
pythonEnv = mnix.mkPython {
requirements = ''
pylatex # latex generation from python
numpy
scipy
matplotlib
pandas
tabulate # pretty print tables of values
pint # quantities, units, uncertainties
ipython
debugpy # needed for DAP
pyclipper # needed for kicad plugin
skidl
lxml # needed for LaTeXText
python-linux-gpib
python-vxi11
'';
};
};
pkgs = (pkgImport nixpkgs) // overridePkgs;
in
{
# Set of machine/build outputs, where key is the machine name and
# the value defines the configuration of the machine.
nixosConfigurations = import ./hosts {
inherit utils lib pkgs system home self;
};
overlay = import ./pkgs;
overlays =
let
overlayDir = ./overlays;
fullPath = name: overlayDir + "/${name}";
overlayPaths = map fullPath (attrNames (readDir overlayDir));
in
pathsToImportedAttrs overlayPaths;
devShell."${system}" = import ./shell.nix {
inherit pkgs;
};
packages."${system}" = pkgs;
# nixosModules = pathsToImportedAttrs (import ./modules/list.nix);
};
}