This repository was archived by the owner on Sep 11, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathmodule.nix
More file actions
84 lines (83 loc) · 3.26 KB
/
Copy pathmodule.nix
File metadata and controls
84 lines (83 loc) · 3.26 KB
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
{mkVersion}: {config, lib, pkgs, ... }: let
cfg = config.programs.quartus;
in {
options.programs.quartus = with lib; {
enable = mkEnableOption "Enables the quartus runner";
lite = {
enable = mkEnableOption "Enable Quartus Prime Lite edition";
version = mkOption {
description = "Major version number";
type = with types; int;
default = 24;
};
devices = mkOption {
description = "Device support (see sources.nix devices)";
type = with types; listOf str;
default = [];
};
installs = mkOption {
description = "Additional components to install (see sources.nix installers)";
type = with types; listOf str;
default = [];
};
};
standard = {
enable = mkEnableOption "Enable Quartus Prime Standard edition";
version = mkOption {
description = "Major version number";
type = with types; int;
default = 23;
};
devices = mkOption {
description = "Device support (see sources.nix devices)";
type = with types; listOf str;
default = [];
};
installs = mkOption {
description = "Additional components to install (see sources.nix installers)";
type = with types; listOf str;
default = [];
};
};
pro = {
enable = mkEnableOption "Enable Quartus Prime Pro edition";
version = mkOption {
description = "Major version number";
type = with types; int;
default = 25;
};
devices = mkOption {
description = "Device support (see sources.nix devices)";
type = with types; listOf str;
default = [];
};
installs = mkOption {
description = "Additional components to install (see sources.nix installers)";
type = with types; listOf str;
default = [];
};
};
};
config = with lib; mkIf cfg.enable {
environment.systemPackages = [(pkgs.stdenvNoCC.mkDerivation {
version = "0.1";
name = "quartus-multi-runner";
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out/bin
${builtins.concatStringsSep "\n" (builtins.map (x: "cp -r ${x}/* $out/") (
builtins.concatMap (
edition: optional cfg.${edition}.enable (pkgs.writeShellScriptBin "quartus-${edition}" ''
${pkgs.nix}/bin/nix shell "${mkVersion {
inherit edition;
version = cfg.${edition}.version;
extraArgs.devices = cfg.${edition}.devices;
extraArgs.installs = cfg.${edition}.installs;
}}" --command "quartus"
''
)) ["lite" "standard" "pro"])
)}
'';
})];
};
}