Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP to add puppet-editor-services and other packages #401

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions flake.nix
genebean marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
self, nixpkgs, nixpkgs-unstable, compose2nix, disko, genebean-omp-themes,
home-manager, nix-darwin, nix-flatpak, nix-homebrew, nixos-hardware, nixpkgs-terraform, sops-nix, ... }: let

local_overlays = import ./modules/overlays { };

# creates a macOS system config
darwinHostConfig = { system, hostname, username, additionalModules, additionalSpecialArgs }: nix-darwin.lib.darwinSystem {
pkgs = import nixpkgs {
Expand All @@ -68,7 +70,10 @@
allowUnfree = true;
permittedInsecurePackages = [ "python-2.7.18.7" ];
};
overlays = [ nixpkgs-terraform.overlays.default ];
overlays = [
local_overlays.local_pkgs
nixpkgs-terraform.overlays.default
];
};
specialArgs = { inherit inputs hostname username; } // additionalSpecialArgs;
modules = [
Expand Down Expand Up @@ -106,7 +111,10 @@
allowUnfree = true;
permittedInsecurePackages = [ "electron-21.4.4" ];
};
overlays = [ nixpkgs-terraform.overlays.default ];
overlays = [
local_overlays.local_pkgs
nixpkgs-terraform.overlays.default
];
};
} // additionalSpecialArgs;
modules = [
Expand Down Expand Up @@ -139,7 +147,10 @@
allowUnfree = true;
permittedInsecurePackages = [ "electron-21.4.4" ];
};
overlays = [ nixpkgs-terraform.overlays.default ];
overlays = [
local_overlays.local_pkgs
nixpkgs-terraform.overlays.default
];
};
} // additionalSpecialArgs;
modules = [
Expand Down
1 change: 1 addition & 0 deletions modules/home-manager/common/all-cli.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ in {
nvd
onefetch
powershell
puppet-editor-services
puppet-lint
rename
ruby
Expand Down
4 changes: 4 additions & 0 deletions modules/overlays/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ ... }: {
# This one brings our custom packages from the 'pkgs' directory
local_pkgs = final: _prev: import ../pkgs { pkgs = final; config.allowUnfree = true; };
}
3 changes: 3 additions & 0 deletions modules/pkgs/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{ pkgs, ... }: {
puppet-editor-services = pkgs.callPackage ./puppet-editor-services { };
}
55 changes: 55 additions & 0 deletions modules/pkgs/puppet-editor-services/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
source ENV['GEM_SOURCE'] || "https://rubygems.org"

# -=-=-=-=-=- WARNING -=-=-=-=-=-
# There should be NO runtime gem dependencies here. In production this code will be running using the Ruby
# runtime provided by Puppet. That means no native extensions and NO BUNDLER. All runtime dependences should
# be re-vendored and then the load path modified appropriately.
#
# This gemfile only exists to help when developing the language server and running tests
# -=-=-=-=-=- WARNING -=-=-=-=-=-

group :development do
gem 'rake', '>= 10.4', :require => false
gem 'rspec', '>= 3.2', :require => false
gem 'puppet-lint', '~> 4.0', :require => false
gem 'puppetfile-resolver', '~> 0.6.2', :require => false
gem 'yard', '~> 0.9.28', :require => false
gem "rubocop", '~> 1.50.0', :require => false
gem "rubocop-performance", '~> 1.16', :require => false
gem "rubocop-rspec", '~> 2.19', :require => false
gem 'rubocop-factory_bot', '!= 2.26.0', require: false
gem 'rubocop-rspec_rails', '!= 2.29.0', require: false
gem 'simplecov', :require => false
gem 'simplecov-console', :require => false

if ENV['PUPPET_GEM_VERSION']
gem 'puppet', ENV['PUPPET_GEM_VERSION'], :require => false
else
gem 'puppet', :require => false
end

case RUBY_PLATFORM
when /darwin/
gem 'CFPropertyList'
end

gem "win32-dir", "<= 0.4.9", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
gem "win32-eventlog", "<= 0.6.5", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
gem "win32-process", "<= 0.7.5", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
gem "win32-security", "<= 0.2.5", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
gem "win32-service", "<= 0.8.8", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]

# Gems for building release tarballs etc.
gem "archive-zip", :require => false
gem "minitar" , :require => false
end

# Evaluate Gemfile.local if it exists
if File.exist? "#{__FILE__}.local"
eval(File.read("#{__FILE__}.local"), binding)
end

# Evaluate ~/.gemfile if it exists
if File.exist?(File.join(Dir.home, '.gemfile'))
eval(File.read(File.join(Dir.home, '.gemfile')), binding)
end
148 changes: 148 additions & 0 deletions modules/pkgs/puppet-editor-services/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.7)
base64
nkf
rexml
ansi (1.5.0)
archive-zip (0.12.0)
io-like (~> 0.3.0)
ast (2.4.2)
base64 (0.2.0)
concurrent-ruby (1.3.3)
deep_merge (1.2.2)
diff-lcs (1.5.1)
docile (1.4.0)
facter (4.7.0)
hocon (~> 1.3)
thor (>= 1.0.1, < 1.3)
fast_gettext (2.4.0)
prime
forwardable (1.3.3)
hocon (1.4.0)
io-like (0.3.1)
json (2.7.2)
locale (2.1.4)
minitar (0.9)
molinillo (0.8.0)
multi_json (1.15.0)
nkf (0.2.0)
parallel (1.25.1)
parser (3.3.2.0)
ast (~> 2.4.1)
racc
prime (0.1.2)
forwardable
singleton
puppet (8.6.0)
concurrent-ruby (~> 1.0)
deep_merge (~> 1.0)
facter (>= 4.3.0, < 5)
fast_gettext (>= 2.1, < 3)
locale (~> 2.1)
multi_json (~> 1.13)
puppet-resource_api (~> 1.5)
scanf (~> 1.0)
semantic_puppet (~> 1.0)
puppet-lint (4.2.4)
puppet-resource_api (1.9.0)
hocon (>= 1.0)
puppetfile-resolver (0.6.3)
molinillo (~> 0.6)
semantic_puppet (~> 1.0)
racc (1.8.0)
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.9.2)
rexml (3.2.9)
strscan
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.50.2)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.2.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
parser (>= 3.3.1.0)
rubocop-capybara (2.21.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.25.1)
rubocop (~> 1.41)
rubocop-performance (1.21.0)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (2.31.0)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-rspec_rails (~> 2.28)
rubocop-rspec_rails (2.28.3)
rubocop (~> 1.40)
ruby-progressbar (1.13.0)
scanf (1.0.0)
semantic_puppet (1.1.0)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-console (0.9.1)
ansi
simplecov
terminal-table
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
singleton (0.2.0)
strscan (3.1.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
thor (1.2.2)
unicode-display_width (2.5.0)
yard (0.9.36)

PLATFORMS
arm64-darwin-23
ruby

DEPENDENCIES
CFPropertyList
archive-zip
minitar
puppet
puppet-lint (~> 4.0)
puppetfile-resolver (~> 0.6.2)
rake (>= 10.4)
rspec (>= 3.2)
rubocop (~> 1.50.0)
rubocop-factory_bot (!= 2.26.0)
rubocop-performance (~> 1.16)
rubocop-rspec (~> 2.19)
rubocop-rspec_rails (!= 2.29.0)
simplecov
simplecov-console
win32-dir (<= 0.4.9)
win32-eventlog (<= 0.6.5)
win32-process (<= 0.7.5)
win32-security (<= 0.2.5)
win32-service (<= 0.8.8)
yard (~> 0.9.28)

BUNDLED WITH
2.5.9
46 changes: 46 additions & 0 deletions modules/pkgs/puppet-editor-services/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{ stdenv, bundlerEnv, fetchFromGitHub, ruby }:
let
# the magic which will include gemset.nix
gems = bundlerEnv {
name = "puppet-editor-services-env";
inherit ruby;
gemdir = ./.;
};
in stdenv.mkDerivation {
name = "puppet-editor-services";
src = fetchFromGitHub {
owner = "puppetlabs";
repo = "puppet-editor-services";
rev = "v2.0.4";
hash = "sha256-bSLOtoOot118YaqF/23unMsOIQq+BdGsZa3JMg1k3Tk=";
};
buildInputs = [gems ruby];
installPhase = ''
mkdir -p $out/{bin,share/puppet-editor-services}
cp -r * $out/share/puppet-editor-services

debugserver=$out/bin/puppet-debugserver
# we are using bundle exec to start in the bundled environment
cat > $debugserver <<EOF
#!/bin/sh -e
exec ${gems}/bin/bundle exec ${ruby}/bin/ruby $out/share/puppet-editor-services/puppet-debugserver "\$@"
EOF
chmod +x $debugserver

languageserver=$out/bin/puppet-languageserver
# we are using bundle exec to start in the bundled environment
cat > $languageserver <<EOF
#!/bin/sh -e
exec ${gems}/bin/bundle exec ${ruby}/bin/ruby $out/share/puppet-editor-services/puppet-languageserver "\$@"
EOF
chmod +x $languageserver

sidecar=$out/bin/puppet-languageserver-sidecar
# we are using bundle exec to start in the bundled environment
cat > $sidecar <<EOF
#!/bin/sh -e
exec ${gems}/bin/bundle exec ${ruby}/bin/ruby $out/share/puppet-editor-services/puppet-languageserver-sidecar "\$@"
EOF
chmod +x $sidecar
'';
}
Loading